node.jsexpressswagger

Accessing Swagger Documentation in the Browser


I am using Node.js, Express.js, and Swagger. I have written documentation of my API in swagger. What URL should I use to view the swagger documentation in the browser?


Solution

  • At last i got the url it is http://localhost:6106/api-docs/ i got hint from this page https://www.npmjs.com/package/swagger-ui-express

    Express setup app.js
    
    const express = require('express');
    const app = express();
    const swaggerUi = require('swagger-ui-express');
    const swaggerDocument = require('./swagger.json');
    
    app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
    

    Thanks every body