forked from Nova-reward/Nova-Rewards
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ts
More file actions
28 lines (22 loc) · 809 Bytes
/
Copy pathmain.ts
File metadata and controls
28 lines (22 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { config, isProduction } from './config/env';
async function bootstrap() {
// Config is already validated at import time
console.log('✅ Environment variables validated successfully');
console.log(`🚀 Starting application in ${config.NODE_ENV} mode`);
const app = await NestFactory.create(AppModule);
// CORS
app.enableCors({
origin: config.CORS_ORIGIN === '*' ? '*' : config.CORS_ORIGIN.split(','),
});
// Global prefix
app.setGlobalPrefix('api');
const port = config.PORT;
await app.listen(port);
console.log(`✅ Application running on http://localhost:${port}`);
}
bootstrap().catch((err) => {
console.error('❌ Failed to start application:', err);
process.exit(1);
});