首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >通过NestJs停靠的应用程序服务静态资产

通过NestJs停靠的应用程序服务静态资产
EN

Stack Overflow用户
提问于 2019-04-16 01:24:19
回答 1查看 532关注 0票数 0

我正在寻找一种方法来在Azure中的一个停靠的NestJs应用程序中为compodoc生成的静态资产提供服务。我正在使用app.useStaticAssets(path.join(__dirname, '\\documentation'));将该文件夹映射为公用文件夹。

..Obviously它在我的机器上工作..。

但不幸的是我在天蓝色上只收到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();
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-04-16 09:37:31

我对此做了一些修改,通过提交我所有的Angular源文件和documentation文件夹,并在应用程序设置中更新Virtual Path,将其添加到应用程序服务中。

应用设置

Compodoc

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55694417

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档