Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add APP_INITIALIZER token handler #1518

Closed
BrunnerLivio opened this issue Feb 2, 2019 · 2 comments
Closed

Add APP_INITIALIZER token handler #1518

BrunnerLivio opened this issue Feb 2, 2019 · 2 comments

Comments

@BrunnerLivio
Copy link
Member

I'm submitting a...


[ ] Regression 
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

Nest does not evaluate the order of the initalization of a provider. It would be useful to load certain providers on application initialization, blocking the initialization of the normal providers in case an APP_INITIALIZOR provider uses a promise.

More in this article

Expected behavior

Providers which uses the APP_INITIALIZER token should be executed when the application is being initalized.

What is the motivation / use case for changing the behavior?

Could be useful to register routes on initialization with #1438

Blockers: #1517

Others:
APP_INITIALIZER Angular Docs

@kamilmysliwiec
Copy link
Member

In most cases, async providers + onModuleInit should be enough. Nonetheless, APP_INITIALIZER might be useful if we want to provide a way to register something once all modules + providers are initialized (but application didn't bootstrap yet).

@kamilmysliwiec
Copy link
Member

I think that now when we have async providers, onModuleInit, onApplicationBootstrap + we're also tracking onApplicationListen, we dont need to introduce another hook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants