Files
n8n-enterprise-unlocked/scripts/backend-module/my-feature.module.template
2025-07-18 14:34:48 +02:00

27 lines
712 B
Plaintext

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];
}
}