我正在寻找一种方法来在Azure中的docker化NestJs应用程序中为compodoc生成的静态资产提供服务。我使用app.useStaticAssets(path.join(__dirname, '\\documentation'));
将文件夹映射为公用文件夹。
..显然它可以在我的机器上运行......
但不幸的是,我只收到404
api按预期工作:
我做错了什么?
静态文件位于专用文件夹文档中:
引导应用程序的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();