Closed jinnatul closed 2 years ago
Recommendation is to place the swagger routes under /docs or something else as to not interfere with your application routes
@scottie1984, Thanks for your response.
Now it's working but when I visit /docs/somthing
then still i got this error.
https://user-images.githubusercontent.com/31995155/102715757-bd9ad000-4301-11eb-839d-49f3ad3c9f07.png
Instead of
app.use('/api-docs', swaggerUI.serve, swaggerUI.setup(swaggerDocs));
you could use
app.use('/api-docs', swaggerUI.serve)
app.get('/api-docs', swaggerUI.setup(swaggerDocs));
Swagger config
app.js
When I visit this route
http://localhost:4000/
then I show swagger UI like this.But, when I visit an anonymous route like
http://localhost:4000/api/data
then I got this error.when i hide this line
// app.use('/', swaggerUI.serve, swaggerUI.setup(swaggerDocs));
then i got my custom error messageSo, how to way I can solve this problem?