DefinitelyTyped/types/swagger-jsdoc/swagger-jsdoc-tests.ts
neilbryson f4bb1a2b74 [swagger-jsdoc] Allow typings to work with --esModuleInterop flag disabled (#37063)
Min TypeScript version decreased from 2.8 to 2.2
2019-07-23 12:35:52 -07:00

27 lines
620 B
TypeScript

import * as express from 'express';
import * as swaggerJSDoc from 'swagger-jsdoc';
const app = express();
const options: swaggerJSDoc.Options = {
swaggerDefinition: {
info: {
title: 'A test api',
version: '1.0.0',
},
host: 'localhost:3000',
basePath: '/',
openapi: '3.0.0',
servers: [{ url: '/api/v1' }, { url: '/api/v2' }],
},
apis: ['./example/routes*.js', './example/parameters.yaml'],
};
const swaggerSpec = swaggerJSDoc(options);
app.get('/api-docs.json', function(req, res) {
res.send(swaggerSpec);
});
app.listen(8888);