Created
July 12, 2022 09:37
-
-
Save fdundjer/c09753d162da16602c1d16e5506670e7 to your computer and use it in GitHub Desktop.
Swagger config in main.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const config = new DocumentBuilder() | |
.setTitle('Service API') | |
.setDescription('Service API') | |
.setVersion('1.0') | |
.addServer('/api/service') | |
.addServer(`http://localhost:${port}/`) | |
.addBearerAuth() | |
.build(); | |
const document = SwaggerModule.createDocument(app, config); | |
SwaggerModule.setup('swagger', app, document); | |
app.use('/swagger.json', (req, res) => { | |
res.send(JSON.stringify(document)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment