feat: 完善后台部署与API前缀配置
This commit is contained in:
1 parent
c821d6c7db
commit
2b1035dbc8
7 files changed
+54
-2
No files matched your search
@@ -458,6 +458,8 @@ export async function createApp(): Promise<NestFastifyApplication> {
|
||||
new ValidationPipe({ whitelist: true, forbidNonWhitelisted: true, transform: true }),
|
||||
);
|
||||
app.useGlobalFilters(new ApiExceptionFilter());
|
||||
const apiPrefix = process.env.API_PREFIX?.replace(/^\/+|\/+$/g, "");
|
||||
if (apiPrefix) app.setGlobalPrefix(apiPrefix);
|
||||
app.use(new RequestIdMiddleware().use.bind(new RequestIdMiddleware()));
|
||||
app.enableCors();
|
||||
return app;
|
||||
|
||||
Reference in new issue
Block a user