Contributions
nodejs unable to display swagger page in nodejs
i wrote a simple code to test ``` constexpress=require('express') constapp=express() constchalk=require('chalk'); constmorgan=require("morgan"); constcors=require('cors'); constswaggerUI=require("swagger-ui-express"); constswaggerJsDoc=require("swagger-jsdoc"); require('dotenv').config(); require('./startup/routes')(app); constoptions={ definition:{ openapi:"3.0.0", info:{ title:"TestingAPI", version:"1.0.0", description:"AsimpleExpressLibraryAPI", }, servers:[ { url:"http://localhost:3000", }, ], }, apis:["server.js"], }; app.get("/hello",(req,res)=> { res.send("hello"); }) constport=process.env.APP_PORT; //constswaggerDocs=swaggerJsDoc(swaggeroption); //app.use('/api-doc',swaggerUi.serve,swaggerUi.setup(swaggerDocs)); constspecs=swaggerJsDoc(options); app.use("/api-docs",swaggerUI.serve,swaggerUI.setup(specs)); app.use(morgan()); app.use(cors()); app.listen(port,()=>{ console.log(chalk.bold.green(`Listeningonport${port}...`)); }); ``` but unable to display /api-docs please help382Views0likes0Comments