Files
travel-planner/backend/apps/worker/src/main.ts
2026-08-17 13:18:24 +02:00

21 lines
573 B
TypeScript

import { INestApplicationContext, Type } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { WorkerModule } from './worker.module';
type ContextFactory = (
module: Type<unknown>,
) => Promise<INestApplicationContext>;
export async function bootstrapWorker(
createContext: ContextFactory = (module) =>
NestFactory.createApplicationContext(module),
): Promise<INestApplicationContext> {
const app = await createContext(WorkerModule);
app.enableShutdownHooks();
return app;
}
if (require.main === module) {
void bootstrapWorker();
}