cors, bug

This commit is contained in:
Ben Wilson
2023-06-21 14:32:33 -04:00
parent 4a937ddd8d
commit 2547b06a48
6 changed files with 126 additions and 24 deletions
+15 -3
View File
@@ -1,12 +1,24 @@
import { ValidationPipe } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify';
import { AppModule } from './app.module';
const PORT = 40557;
async function bootstrap() {
const app = await NestFactory.create<NestFastifyApplication>(AppModule, new FastifyAdapter());
await app.listen(PORT, '0.0.0.0');
console.log(`http listening on port ${PORT}`)
app.setGlobalPrefix('api')
app.useGlobalPipes(
new ValidationPipe({
transform: true,
whitelist: true,
forbidNonWhitelisted: true,
forbidUnknownValues: true
}),
);
app.enableCors();
await app.listen(process.env.PORT);
console.log(`http listening on port ${process.env.PORT}`)
}
bootstrap();