expressjs swagger yaml

Solutions on MaxInterview for expressjs swagger yaml by the best coders in the world

showing results for - "expressjs swagger yaml"
Niko
01 Apr 2018
1// To load your swagger specification yaml file you need to use a module able to convert 
2// yaml to json; for instance yamljs.
3
4>> npm install --save yamljs
5
6const express = require('express');
7const app = express();
8const swaggerUi = require('swagger-ui-express');
9const YAML = require('yamljs');
10const swaggerDocument = YAML.load('./swagger.yaml');
11
12app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));