Answers for "expressjs swagger yaml"

0

expressjs swagger yaml

// To load your swagger specification yaml file you need to use a module able to convert 
// yaml to json; for instance yamljs.

>> npm install --save yamljs

const express = require('express');
const app = express();
const swaggerUi = require('swagger-ui-express');
const YAML = require('yamljs');
const swaggerDocument = YAML.load('./swagger.yaml');

app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
Posted by: Guest on January-27-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language