You’ve been playing with Swagger and can now see the benefits, and you are planning to use a YAML file, now you would like to display it to the outside work, here is a short article explaining all that is required. This is based on you using Express within Node.js
Swagger UI Express
Adds middleware to your express app to serve the Swagger UI bound to your Swagger document. This acts as living documentation for your API hosted from within your app.
Swagger version is pulled from npm module swagger-ui-dist. Please use a lock file or specify the version of swagger-ui-dist you want to ensure it is consistent across environments.
Install using npm:
Load swagger from yaml file
To load your swagger specification yaml file you need to use a module able to convert yaml to json ; for instance
npm install --save yamljs
const express = ; const app = const swaggerUi = ; const YAML = ; const swaggerDocument = YAML; app;