【发布时间】:2019-09-05 17:52:15
【问题描述】:
我正在寻找一种方法来提供由 compodoc 在 Azure 中的 dockerized NestJs 应用程序中生成的静态资产。
我正在使用app.useStaticAssets(path.join(__dirname, '\\documentation')); 将文件夹映射为公用文件夹。
..显然它可以在我的机器上运行...
但不幸的是,在 azure 上我只收到 404
api 按预期工作:
我做错了什么?
静态文件位于专用文件夹documentation:
引导应用程序的 main.ts:
async function bootstrap() {
const app = await NestFactory.create<NestExpressApplication>(ApplicationModule);
app.useGlobalPipes(new ValidationPipe({ transform: true } as ValidationPipeOptions));
SwaggerModule.setup('api', app, SwaggerModule.createDocument(app, new DocumentBuilder()
.setTitle('N Playground')
.setDescription('A NestJs Playground API')
.setVersion('0.1')
.addTag('player')
.build()));
app.useStaticAssets(path.join(__dirname, '\\documentation'));
app.useGlobalInterceptors(new StopWatchInterceptor());
const port = 8080;
app.listen(port, () => {
console.log(`Application is listening on port ${port}`);
});
}
bootstrap();
【问题讨论】:
标签: node.js azure docker nestjs