sonic-express
sonic-express copied to clipboard
Unable to generate the swagger.json file
I have attempted to follow the examples here to a T, but I'm still unable to generate the swagger.json file. This is how my configuration looks like // Config
const version = process.env.VERSION;
const swaggerDefinition = {
openapi: '3.0.1',
info: {
title: 'Demo server',
version,
description: 'Fida',
},
servers: [
{
url: '/api/v1',
description: 'Host system path',
},
],
definition: {},
paths: {},
};
// options for the swagger docs
const options = (fileName) => ({
// import swaggerDefinitions
swaggerDefinition,
// path to the API docs
apis: [fileName],
});
export default options;
src/main.ts file
private readonly app: Express;
constructor() {
this.app = express();
this.config();
this.routes()
}
private config(): void {
if (process.env.NODE_ENV === 'dev') {
this.app.use(getResponseExpress(this.app, options(__filename), './src/swagger.json'));
}
}
When I make my requests, the swagget.json file isn't updated