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.
I'm tearing my hair out with this one. It works perfectly on my local machine, but not once I push it live.
import express from 'express';
import swaggerUi from 'swagger-ui-express';
import YAML from 'yamljs';
const swaggerDocument = YAML.load('./spec.yaml');
var router = express.Router();
console.log(swaggerDocument); // Shows that it's using my current document version
router.use('/docs', swaggerUi.serve);
router.get('/docs', swaggerUi.setup(swaggerDocument, { explorer: true }));
When I then navigate to /docs I get swagger ui using my old spec (after reboot of express).
The express logs show that I am hitting it (no nginx caching or anything).
GET /docs/ 200 5.789 ms - 3043
GET /docs/swagger-ui.css 200 5.600 ms - 143858
GET /docs/swagger-ui-standalone-preset.js 200 3.698 ms - 324275
GET /docs/swagger-ui-bundle.js 200 3.585 ms - 1086481
GET /docs/swagger-ui.css.map 200 2.515 ms - 275373
GET /docs/swagger-ui-bundle.js.map 200 2.476 ms - 4304715
GET /docs/swagger-ui-standalone-preset.js.map 200 45.932 ms - 1424902
I'm tearing my hair out with this one. It works perfectly on my local machine, but not once I push it live.
When I then navigate to
/docs
I get swagger ui using my old spec (after reboot of express).The express logs show that I am hitting it (no nginx caching or anything).
What am I doing wrong?