1
0
mirror of https://github.com/stonith404/pingvin-share.git synced 2024-11-15 20:00:33 +01:00
pingvin-share/backend/src/main.ts

24 lines
891 B
TypeScript
Raw Normal View History

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";
import * as bodyParser from "body-parser";
2023-01-04 11:54:28 +01:00
import * as cookieParser from "cookie-parser";
import * as fs from "fs";
import { AppModule } from "./app.module";
2022-10-24 12:11:10 +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 }));
app.useGlobalInterceptors(new ClassSerializerInterceptor(app.get(Reflector)));
app.use(bodyParser.raw({ type: "application/octet-stream", limit: "20mb" }));
2023-01-04 11:54:28 +01:00
app.use(cookieParser());
2022-10-24 12:11:10 +02:00
app.set("trust proxy", true);
await fs.promises.mkdir("./data/uploads/_temp", { recursive: true });
app.setGlobalPrefix("api");
await app.listen(8080);
}
bootstrap();