feat: add nestjs api and worker skeletons

This commit is contained in:
Bastian Wagner
2026-08-17 13:18:24 +02:00
parent c23bda56a3
commit a08eecd4e3
17 changed files with 124 additions and 32 deletions

View File

@@ -0,0 +1,20 @@
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();
}