Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions website/src/docs/nitro/integrations/hot-chocolate.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,20 @@ In this configuration, the GraphQL service remains at the `/graphql` endpoint, a

In some scenarios, you may not want to serve Nitro, e.g., in a production environment. You can disable Nitro by setting the `Enable` property to `false`:

_Before (v15 and below):_
```csharp
endpoints
.MapGraphQL()
.WithOptions(o => o.Enable = false);
```

_After (v16):_
```csharp
endpoints
.MapGraphQL()
.WithOptions((NitroAppOptions o) => o.Enable = false);
```

# Serve Modes

The `ServeMode` property controls which version of Nitro to serve. The default mode is `Latest`, serving the most recent version of Nitro from a CDN.
Expand All @@ -47,12 +55,20 @@ You can also serve the embedded version (`Embedded`) of Nitro, which is included

Depending on your environment or preferences, you can choose the appropriate mode:

_Before (v15 and below):_
```csharp
endpoints
.MapNitroApp()
.WithOptions(o => o.ServeMode = ServeMode.Embedded);
```

_After (v16):_
```csharp
endpoints
.MapGraphQL()
.WithOptions((NitroAppOptions o) => o.ServeMode = ServeMode.Embedded);
```

# Configuration Options

You can tailor Nitro to your needs by setting various options via `NitroAppOptions`. You can specify these options using the `WithOptions()` method in both `MapGraphQL()` and `MapNitroApp()` methods.
Expand All @@ -71,6 +87,7 @@ You can tailor Nitro to your needs by setting various options via `NitroAppOptio

Here is an example of how to set these options:

_Before (v15 and below):_
```csharp
endpoints
.MapNitroApp()
Expand All @@ -84,3 +101,18 @@ endpoints
o.Enable = true;
});
```

_After (v16):_
```csharp
endpoints
.MapNitroApp()
.WithOptions((NitroAppOptions o) =>
{
o.ServeMode = ServeMode.Insider;
o.Title = "My GraphQL API";
o.Document = "Query { hello }";
o.GraphQLEndpoint = "/api/graphql";
o.IncludeCookies = true;
o.Enable = true;
});
```
Loading