You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now the only way to use the Joi middleware is to pass a configuration to the router. It would be more flexible to be able to use the middleware directly.
For example, instead of:
router.get('/user',config,handler)
It should be possible to do:
router.get('/user',joiMiddleware(config),handler)
This is more inline with a middleware based framework, allows the validation to be used after other middlewares, and enables wrapping and testing the validator.
I think this could be done in 2 ways. Either expose the middleware directly from the module, or extract the middleware to a joi-middleware project on which joi-router would depend. The second option is my personal favorite since it would also allow the middleware to be used with other routers. The first option however is definitely easier to implement.
The text was updated successfully, but these errors were encountered:
Right now the only way to use the Joi middleware is to pass a configuration to the router. It would be more flexible to be able to use the middleware directly.
For example, instead of:
It should be possible to do:
This is more inline with a middleware based framework, allows the validation to be used after other middlewares, and enables wrapping and testing the validator.
I think this could be done in 2 ways. Either expose the middleware directly from the module, or extract the middleware to a
joi-middleware
project on whichjoi-router
would depend. The second option is my personal favorite since it would also allow the middleware to be used with other routers. The first option however is definitely easier to implement.The text was updated successfully, but these errors were encountered: