Files
bidding_watcher/src/main.ts
dmy 811ad927f3 feat(logging): add logging middleware for HTTP requests and update API timeout
- Introduce LoggingMiddleware to log incoming requests and their response times
- Update AppModule to apply the new logging middleware globally
- Increase API request timeout from 10 seconds to 60 seconds
- Modify PromptString to include additional project types of interest
2026-01-15 21:52:40 +08:00

27 lines
810 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'dotenv/config';
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { CustomLogger } from './common/logger/logger.service';
async function bootstrap() {
const app = await NestFactory.create(AppModule, {
bodyParser: true,
});
// 使用自定义日志服务
const logger = await app.resolve(CustomLogger);
app.useLogger(logger);
// 增加请求体大小限制(默认 100kb增加到 50mb
// eslint-disable-next-line @typescript-eslint/no-require-imports
const express = require('express') as typeof import('express');
app.use(express.json({ limit: '50mb' }));
app.use(express.urlencoded({ limit: '50mb', extended: true }));
// 启用 CORS
app.enableCors();
await app.listen(process.env.PORT ?? 3000);
}
void bootstrap();