arb / celebrate

A joi validation middleware for Express.
MIT License
1.33k stars 66 forks source link

Validate req.params #127

Closed sjgmojica closed 5 years ago

sjgmojica commented 5 years ago

Hi Just wanna ask how can I validate the value of req.params from middleware? Thanks

arb commented 5 years ago

Check out https://github.com/arb/celebrate/blob/master/test/integration.test.js#L53-L74 for an in-code example.

Generally speaking, you'd do

celebrate({
  params: { //schema goes here }
})
sjgmojica commented 5 years ago

Nice.Thanks

On Tue, 20 Aug 2019 at 8:43 PM Adam Bretz notifications@github.com wrote:

Check out https://github.com/arb/celebrate/blob/master/test/integration.test.js#L53-L74 for an in-code example.

Generally speaking, you'd do

celebrate({ params: { //schema goes here } })

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/arb/celebrate/issues/127?email_source=notifications&email_token=ADMRMJWXTJ3GBUSQYJAO5PTQFPRHTA5CNFSM4INPTQBKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4WEXAY#issuecomment-522996611, or mute the thread https://github.com/notifications/unsubscribe-auth/ADMRMJQRESFE4UVCC7NGJOTQFPRHTANCNFSM4INPTQBA .