Skip to content

Commit 641a126

Browse files
committed
docs(@nestjs/swagger): add description on how to expose swagger json file
Docs weren't complete on exposing json spec with using only @nestjs/swagger
1 parent 1be2078 commit 641a126

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

content/openapi/introduction.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ While the application is running, open your browser and navigate to `http://loca
6161
As you can see, the `SwaggerModule` automatically reflects all of your endpoints.
6262

6363
> info **Hint** To generate and download a Swagger JSON file, navigate to `http://localhost:3000/api-json` (assuming that your Swagger documentation is available under `http://localhost:3000/api`).
64+
> It is also possible to expose it on a route of your choice using only the setup method from `@nestjs/swagger`, like this:
65+
> ```typescript
66+
> SwaggerModule.setup('swagger', app, document, {
67+
> jsonDocumentUrl: 'swagger/json',
68+
> });
69+
> ```
70+
> Which would expose it at `http://localhost:3000/swagger/json`
71+
6472
6573
> warning **Warning** When using `fastify` and `helmet`, there may be a problem with [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP), to solve this collision, configure the CSP as shown below:
6674
>

0 commit comments

Comments
 (0)