我正在使用NestJS
版本7.1.0
和serverless
创建 api 文档使用nestjs swagger
. 在本地它像冠军一样工作,但在部署后出现错误。
swagger-ui-express package is missing
我在这里看到了一些问题,但仍未解决此问题。 https://github.com/nestjs/swagger/issues/277
这是我的package.json
"dependencies": {
"@nestjs/common": "^7.1.0",
"@nestjs/core": "^7.1.0",
"@nestjs/passport": "^7.0.0",
"@nestjs/platform-express": "^7.0.7",
"@nestjs/swagger": "^4.5.8",
"aws-serverless-express-binary": "^1.0.1",
"class-transformer": "^0.2.3",
"class-validator": "^0.11.1",
"dayjs": "^1.8.24",
"dotenv": "^8.2.0",
"dynamodb-data-types": "^3.0.1",
"express": "^4.17.1",
"faker": "^4.1.0",
"jest": "^24.9.0",
"jwks-rsa": "^1.6.0",
"latinize": "^0.4.1",
"lodash": "^4.17.15",
"mime-types": "^2.1.26",
"passport": "^0.4.1",
"passport-jwt": "^4.0.0",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.0",
"rxjs": "^6.5.3",
"serverless-dynamodb-local": "^0.2.39",
"swagger-ui-express": "^4.1.4",
"tslint-loader": "^3.5.4",
"uuid": "^3.3.3",
"winston": "^3.2.1"
},
这是配置:
const options = new DocumentBuilder()
.setTitle("My APIs")
.setDescription("APIs description")
.setVersion("1.0")
.addTag("cats")
.build();
const document = SwaggerModule.createDocument(app, options);
SwaggerModule.setup("api", app, document);
任何帮助!