-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Synchronous plugin registration #2690
Comments
This is already the case for any auth scheme or anything other than the three built-in plugins. I don't see this as a real problem. It might be annoying at first but eventually people will just get use to it (or better yet, glue will add built-in support directly). |
Why not remove the callback requirement from |
Because this is not the right way to solve the issue. hapi is designed to work with plugins and you are optimizing for the most basic use case. |
To me, designed to work with plugins, reads as: should be simple to use plugins, which my proposal aims at. The most basic use case is the one new users are likely to be confronted with. Requiring nesting, or empty function arguments, is somewhat off-putting. Anyway, I don't intend to fight on this, and the current implementation is fine for my private usage. |
The only way this doesn't lead to future pain because people are just ignoring the callback is if we add a plugin attribute called |
It seems that you miss my point. My suggestion is that errors that should have triggered in a missing register callback are instead triggered in the |
This is weird. You would call register and if there are errors, you would get them returned when you call start() or initialize()? This will be a nightmare to debug when things go wrong and your tests are not starting the server. |
Hapi 9.x will require eg.
inert
to be registered before itsfile
anddirectory
handlers can be used.This is fine but the new process seems a bit off, requiring all such routes to be embedded in the registration callback. Alternatively, the user would need to know that the registration is actually synchronous, and that the callback can be ignored and an empty function should be provided.
Ideally, it should just be something like:
instead of:
or:
The text was updated successfully, but these errors were encountered: