mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-05-07 02:46:42 +02:00
31 lines
921 B
TypeScript
31 lines
921 B
TypeScript
import { NestFactory } from "@nestjs/core";
|
|
import type { NestExpressApplication } from "@nestjs/platform-express";
|
|
import { AppModule } from "./app.module.js";
|
|
|
|
function validateEnv() {
|
|
if (!process.env.SYNC_TOKEN && !process.env.SYNC_JWT_PUBLIC_KEY) {
|
|
console.error("Either SYNC_TOKEN or SYNC_JWT_PUBLIC_KEY must be set");
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
async function bootstrap() {
|
|
validateEnv();
|
|
|
|
const app = await NestFactory.create<NestExpressApplication>(AppModule);
|
|
|
|
// biome-ignore lint/correctness/useHookAtTopLevel: NestJS method, not a React hook
|
|
app.useBodyParser("json", { limit: "50mb" });
|
|
|
|
app.enableCors({
|
|
origin: "*",
|
|
methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
|
|
allowedHeaders: ["Content-Type", "Authorization"],
|
|
});
|
|
|
|
const port = process.env.PORT ?? 3929;
|
|
await app.listen(port);
|
|
console.log(`Donut Sync service running on port ${port}`);
|
|
}
|
|
void bootstrap();
|