# .Net Middleware - Nitro

> Serve Nitro from your Hot Chocolate server: MapGraphQL() hosts it at /graphql by default, or use MapNitroApp() to expose the IDE on a separate endpoint.

Canonical source: https://chillicream.com/docs/nitro/integrations/hot-chocolate

By default, when you map your GraphQL endpoints using `MapGraphQL()`, Nitro is automatically served at the `/graphql` endpoint.

C#

```
app.UseEndpoints(endpoints =>
{
    endpoints.MapGraphQL();
});
```

In the example above, the GraphQL service and Nitro are both mapped to the `/graphql` endpoint.

If you want to serve Nitro on a separate endpoint, you can use `MapNitroApp()` method:

C#

```
app.UseEndpoints(endpoints =>
{
    endpoints.MapGraphQL();
    endpoints.MapNitroApp("/my-graphql-ui");
});
```

In this configuration, the GraphQL service remains at the `/graphql` endpoint, and Nitro is served at the `/my-graphql-ui` endpoint.

## Disable the Middleware

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`:

C#

```
endpoints
  .MapGraphQL()
  .WithOptions(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. You can also serve the embedded version (`Embedded`) of Nitro, which is included in the package.

- `Latest`: Serves the latest version of Nitro from a CDN.
- `Insider`: Serves the insider version of Nitro from a CDN, allowing preview of upcoming features.
- `Embedded`: Serves the embedded version of Nitro that comes with the package.
- `Version(string version)`: Serves a specific version of Nitro from the CDN.

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

C#

```
endpoints
  .MapNitroApp()
  .WithOptions(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.

| Property                       | Type              | Description                                                                                                                                   |
| ------------------------------ | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| Enable                         | bool              | If false, disables the Nitro tool.                                                                                                            |
| ServeMode                      | ServeMode         | Defines how Nitro is served. Options include Latest (default), Insider, Embedded, and Version(string version).                                |
| Title                          | string            | Specifies the title of the Nitro page.                                                                                                        |
| Document                       | string            | Specifies the default document content.                                                                                                       |
| IncludeCookies                 | bool?             | If true, includes cookies in the HTTP call to the GraphQL backend.                                                                            |
| HttpHeaders                    | IHeaderDictionary | Specifies the default HTTP headers for Nitro.                                                                                                 |
| UseGet                         | bool              | If true, uses HTTP GET as the default request method.                                                                                         |
| GraphQLEndpoint                | string            | Specifies the GraphQL endpoint. If UseBrowserUrlAsGraphQLEndpoint is true, it must be a relative path; otherwise, it must be an absolute URL. |
| UseBrowserUrlAsGraphQLEndpoint | bool              | If true, the schema endpoint URL is inferred from the browser URL.                                                                            |

Here is an example of how to set these options:

C#

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

[Edit this page on GitHub](https://github.com/ChilliCream/graphql-platform/edit/main/website/content/docs/nitro/integrations/hot-chocolate.md)

Last updated on **June 30, 2026** by **Tobias Tengler**
