Swagger basePath无法正常运行主机正确,但api仍无法正常运行为什么?

问题描述

const swaggerOptions = {
  swaggerDeFinition: {
    info: {
      version: "1.0.0",title: "Attendance System API",description: "Attendance System API @R_462_4045@ion",contact: {
        name: "Kellton Developer"
      },host: ["http://localhost:3000"],basePath: "/api/v1"
    }
  },schemes: ["https","http"],tags: [{
    name: "login",description: "user can login here",}],// ['.routes/*.js']
  apis: ['./routes/index.js']
};

const swaggerDocs = swaggerJsDoc(swaggerOptions);
app.use("/api-docs",swaggerUi.serve,swaggerUi.setup(swaggerDocs));

app.use('/api/v1/',indexRouter);

它总是命中 http:// localhost:3000 / login 但应该是这样的 http:// localhost:3000 / login / api / v1 / login

我猜Swagger basePath无法正常工作。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)