feat(core): Set up backend modules (#17448)

This commit is contained in:
Iván Ovejero
2025-07-18 14:34:48 +02:00
committed by GitHub
parent 78cb5b6409
commit 115934573f
11 changed files with 528 additions and 1 deletions

View File

@@ -0,0 +1,26 @@
import type { ModuleInterface } from '@n8n/decorators';
import { BackendModule, OnShutdown } from '@n8n/decorators';
import { Container } from '@n8n/di';
@BackendModule({ name: 'my-feature' })
export class MyFeatureModule implements ModuleInterface {
async init() {
await import('./my-feature.controller');
const { MyFeatureService } = await import('./my-feature.service');
Container.get(MyFeatureService).start();
}
@OnShutdown()
async shutdown() {
const { MyFeatureService } = await import('./my-feature.service');
await Container.get(MyFeatureService).shutdown();
}
async entities() {
const { MyFeatureEntity } = await import('./my-feature.entity');
return [MyFeatureEntity];
}
}