Swagger module ignores setGlobalPrefix()
See original GitHub issueI’m submitting a…
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
When setting setGlobalPrefix('v2')
and using the Swagger module as described in the doc with SwaggerModule.setup('api', app, document)
, the API is actually available under /api
and /v2/api
throws a 404 Cannot GET /v2/api
.
It works when setting SwaggerModule.setup('v2/api', app, document)
, but this introduces duplication.
Expected behavior
I expected the global prefix to be applied to the Swagger module’s path, too.
Minimal reproduction of the problem with instructions
Repro repo. Created with the CLI, only added swagger module as described in the doc and setGlobalPrefix()
.
Environment
Nest version: 5.0.1
Issue Analytics
- State:
- Created 5 years ago
- Reactions:10
- Comments:21 (5 by maintainers)
Top Results From Across the Web
prefix url in Swagger module - node.js - Stack Overflow
I am using nest js and swagger as documentation but Swagger module ignores setGlobalPrefix(). in my environemnt the api prefix is ...
Read more >Other features - OpenAPI - A progressive Node.js framework
To ignore a global prefix for routes set through setGlobalPrefix() , use ignoreGlobalPrefix : const document = SwaggerModule.createDocument(app, options ...
Read more >A Guide to NestJS Swagger Configuration - Bits and Pieces
Let's bootstrap the NestJS swagger module into our app. ... swagger will ignore the global prefix set through `setGlobalPrefix()` method
Read more >A Guide to NestJS Swagger Configuration
Next step is to bootstrap the NestJS Swagger Module in our application. ... ignore the global prefix set through `setGlobalPrefix()` method ...
Read more >@nestjs/core NestFactory TypeScript Examples
createDocument(app, options); SwaggerModule.setup('api', app, document); await app.listen(port, async () => { console.log(`The server is running on ${port} ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just tried to reproduce this issue and for me, everything is working correctly. My code:
@renatogbp try to change operations order.