Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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));
Source by www.npmjs.com #
 
PREVIOUS NEXT
Tagged: #expressjs #swagger #yaml
ADD COMMENT
Topic
Name
9+4 =