main.ts•621 B
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import * as dotenv from 'dotenv';
dotenv.config();
async function bootstrap() {
const app = await NestFactory.create(AppModule);
// 启用 CORS
app.enableCors({
origin: '*',
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
credentials: true,
});
const port = process.env.CHAT_API_PORT || 3000;
await app.listen(port);
console.log(`🚀 Chat API Server running on http://localhost:${port}`);
console.log(`📊 MCP Server will be available on port ${process.env.MCP_SERVER_PORT || 3001}`);
}
bootstrap();