2022-10-09 22:30:32 +02:00
|
|
|
import { ClassSerializerInterceptor, ValidationPipe } from "@nestjs/common";
|
|
|
|
import { NestFactory, Reflector } from "@nestjs/core";
|
2022-10-24 12:11:10 +02:00
|
|
|
import { NestExpressApplication } from "@nestjs/platform-express";
|
2023-01-04 11:54:28 +01:00
|
|
|
import * as cookieParser from "cookie-parser";
|
2022-10-09 22:30:32 +02:00
|
|
|
import * as fs from "fs";
|
|
|
|
import { AppModule } from "./app.module";
|
2022-10-24 12:11:10 +02:00
|
|
|
|
2022-10-09 22:30:32 +02:00
|
|
|
async function bootstrap() {
|
2022-10-24 12:11:10 +02:00
|
|
|
const app = await NestFactory.create<NestExpressApplication>(AppModule);
|
2022-12-05 16:54:15 +01:00
|
|
|
app.useGlobalPipes(new ValidationPipe({ whitelist: true }));
|
2022-10-09 22:30:32 +02:00
|
|
|
app.useGlobalInterceptors(new ClassSerializerInterceptor(app.get(Reflector)));
|
|
|
|
|
2023-01-04 11:54:28 +01:00
|
|
|
app.use(cookieParser());
|
2022-10-24 12:11:10 +02:00
|
|
|
app.set("trust proxy", true);
|
|
|
|
|
2022-10-12 00:38:38 +02:00
|
|
|
await fs.promises.mkdir("./data/uploads/_temp", { recursive: true });
|
2022-10-09 22:30:32 +02:00
|
|
|
|
|
|
|
app.setGlobalPrefix("api");
|
|
|
|
await app.listen(8080);
|
|
|
|
}
|
|
|
|
bootstrap();
|