mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(core): Set up backend modules (#17448)
This commit is contained in:
26
scripts/backend-module/my-feature.module.template
Normal file
26
scripts/backend-module/my-feature.module.template
Normal 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];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user