2021-04-13 21:53:58 +02:00

26 lines
608 B
TypeScript

import { Logger, ValidationPipe } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app/app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.enableCors();
const globalPrefix = 'api';
app.setGlobalPrefix(globalPrefix);
app.useGlobalPipes(
new ValidationPipe({
forbidNonWhitelisted: true,
transform: true,
whitelist: true
})
);
const port = process.env.PORT || 3333;
await app.listen(port, () => {
Logger.log(`Listening at http://localhost:${port}`);
});
}
bootstrap();