29 lines
625 B
TypeScript
29 lines
625 B
TypeScript
import { NestFactory } from '@nestjs/core';
|
|
import { ValidationPipe } from '@nestjs/common';
|
|
import { AppModule } from './app.module';
|
|
|
|
async function bootstrap() {
|
|
const app = await NestFactory.create(AppModule);
|
|
|
|
app.enableCors({
|
|
origin: true, // allow all origins in dev
|
|
credentials: true,
|
|
});
|
|
|
|
app.setGlobalPrefix('api/v1');
|
|
|
|
app.useGlobalPipes(
|
|
new ValidationPipe({
|
|
whitelist: true,
|
|
transform: true,
|
|
forbidNonWhitelisted: true,
|
|
}),
|
|
);
|
|
|
|
const port = process.env.PORT || 3001;
|
|
await app.listen(port);
|
|
console.log(`The Vibe API running on port ${port}`);
|
|
}
|
|
|
|
bootstrap();
|