Initial SuperAdmin API (NestJS + Prisma)
This commit is contained in:
+32
@@ -0,0 +1,32 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { RequestMethod, ValidationPipe } from '@nestjs/common';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { AppModule } from './app.module';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
const config = app.get(ConfigService);
|
||||
|
||||
app.setGlobalPrefix('api', {
|
||||
exclude: [{ path: 'get_user', method: RequestMethod.GET }],
|
||||
});
|
||||
|
||||
app.enableCors({
|
||||
origin: config.get<string>('CORS_ORIGIN', 'http://localhost:5173'),
|
||||
credentials: true,
|
||||
});
|
||||
|
||||
app.useGlobalPipes(
|
||||
new ValidationPipe({
|
||||
whitelist: true,
|
||||
transform: true,
|
||||
forbidNonWhitelisted: true,
|
||||
}),
|
||||
);
|
||||
|
||||
const port = Number(config.get('PORT') ?? 3001);
|
||||
await app.listen(port);
|
||||
console.log(`SuperAdmin API listening on http://localhost:${port}`);
|
||||
}
|
||||
|
||||
bootstrap();
|
||||
Reference in New Issue
Block a user