ext in defaultConfig, "onPreHandler" must be an object #38
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hello, I'm new to Hapi.js and its 'ext'
I have a problem with this plugin when adding default config with 'onPrehandler'
defaultConfig: { auth: false, ext: { onPreHandler: (request, reply)=>{ debug(request) request.query.limit=25; reply.continue(); } } },
the error is
"onPreHandler" must be an object
How can I solve it?
I want requests to always have a limit, maybe there is a better way to do this?
Thanks
@ds009 Hey, I personally am not sure about it as I didn't have to use it yet. 🤔
I found this example on their documentation though:
Maybe you should pass something like:
@mdibaiee Thank you for your reply, I tried this way but it didn't work. I switched to another solution by not using 'ext'.
@ds009 glad you got to fix your problem. Would you mind sharing your solution so others who might encounter it in the future could use your answer? Thanks 😁 👍
@mdibaiee Sorry, I just wrote a part of routes myself without using this plugin, it's not an elegant solution worth to be shared...