Startup Task #1509
Answered
by
detroitpro
detroitpro
asked this question in
Q&A
Startup Task
#1509
-
Is it suggested to use Agenda for a I need to check if a record has been created in the database and create it if not. |
Beta Was this translation helpful? Give feedback.
Answered by
detroitpro
Aug 31, 2021
Replies: 1 comment 2 replies
-
I think using export class Server {
@Inject()
app: PlatformApplication | undefined;
@Inject()
workers: Workers | undefined; // inject `service` here.
@Configuration()
settings: Configuration | undefined;
$beforeRoutesInit(): void {
this.app
?.use(cors())
.use(cookieParser())
.use(compress({}))
.use(methodOverride())
.use(express.json())
.use(express.urlencoded({ extended: true }));
}
async $onReady(): Promise<void> { // use $onReady hook to perform action when server is started
await this.workers?.init();
}
} |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
Romakita
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think using
hooks
is the answer.