-
Notifications
You must be signed in to change notification settings - Fork 2
ParamConverter
cedric lombardot edited this page May 27, 2016
·
2 revisions
For example we are on // GET /:category_slug-:post_slug/comments
And we write
@ParamConverter('post', { 'model': 'Post', 'filterBy': { 'slug': 'post_slug' } })The param converter will declare req.post with the post having slug in req.params.post_slug or req.query.post_slug
If post is not found will return a 404 without enter in the controller.
Options :
- filterBy : An associated object with columns => param name or and array of params
- model : The container.model