This commit is contained in:
Bastian Wagner
2026-07-15 14:09:28 +02:00
commit 3e5348b7ec
104 changed files with 30367 additions and 0 deletions

44
apps/api/src/main.ts Normal file
View File

@@ -0,0 +1,44 @@
import 'reflect-metadata';
import { ValidationPipe } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import express, { NextFunction, Request, Response } from 'express';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule, { bodyParser: false });
app.enableCors({
origin: process.env.PUBLIC_WEB_URL ?? 'http://localhost:4200',
credentials: true,
});
const jsonParser = express.json();
const formParser = express.urlencoded({ extended: false });
app.use((request: Request, response: Response, next: NextFunction) => {
if (request.path.startsWith('/oidc') || request.path.startsWith('/.well-known')) {
next();
return;
}
jsonParser(request, response, (jsonError) => {
if (jsonError) {
next(jsonError);
return;
}
formParser(request, response, next);
});
});
app.useGlobalPipes(
new ValidationPipe({
whitelist: true,
forbidNonWhitelisted: true,
transform: true,
}),
);
const port = Number(process.env.API_PORT ?? 3000);
await app.listen(port);
}
void bootstrap();