小编Esc*_*890的帖子

当与 nginx 一起部署时,NestJs 在所有路由上返回 404,但在本地一切正常

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { CoreConfig } from './config.const';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { NestApplicationOptions } from '@nestjs/common';

async function bootstrap() {
  const httpOptions ={
    requestCert: false,
    rejectUnauthorized: true,
  };
  const app = await NestFactory.create(AppModule);
  const options = new DocumentBuilder()
    .addServer(`http://localhost:${CoreConfig.app.port}`)
    .setTitle('test UI/AI')
    .setDescription('UI meta service')
    .setVersion('1.0')
    .addTag('test')
    .addBearerAuth({type:'http', bearerFormat: 'authorization'})
    .build();
  const document = SwaggerModule.createDocument(app, options);
  SwaggerModule.setup('docs', app, document);
  app.enableCors();
  app.setGlobalPrefix('ui');
  await app.listen(CoreConfig.app.port);
}

bootstrap().then();
Run Code Online (Sandbox Code Playgroud)

当我的应用程序使用 …

nginx node.js jenkins docker nestjs

1
推荐指数
1
解决办法
2200
查看次数

标签 统计

docker ×1

jenkins ×1

nestjs ×1

nginx ×1

node.js ×1