Skip to content

Instantly share code, notes, and snippets.

@fdundjer
Created July 12, 2022 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fdundjer/c09753d162da16602c1d16e5506670e7 to your computer and use it in GitHub Desktop.
Save fdundjer/c09753d162da16602c1d16e5506670e7 to your computer and use it in GitHub Desktop.
Swagger config in main.ts
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