Skip to content

Instantly share code, notes, and snippets.

@rajiff
Created December 19, 2017 06:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rajiff/1a901fb12a1de72df50d95abfac11cc3 to your computer and use it in GitHub Desktop.
Save rajiff/1a901fb12a1de72df50d95abfac11cc3 to your computer and use it in GitHub Desktop.
const express = require('express');
const swaggerUI = require('swagger-ui-express');
const YAML = require('yamljs');
const swaggerDocument = YAML.load('./api/swagger/swagger.yaml');
let app = express();
// Mount the SwaggerUI Middleware, at your preferred mount path
let swaggerOptions = { explorer: false };
app.use('/api/v1/docs',
swaggerUI.serve,
swaggerUI.setup(swaggerDocument, swaggerOptions)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment