Replies: 1 comment 5 replies
-
You could use Params matchers : https://docs.adonisjs.com/guides/routing#params-matchers In this case if the uuid sent is not valid, then the router will not redirect the action to your controller and your application will return a 404. Example : Route
.get('/users/:id', 'MyController.show')
.where('id', Route.matchers.uuid()) |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using
uuid_generate_v4()
, and when I pass some invalid format via query, I get an error, I'd rather want to hide from the end-user.GET /users/1
throws an error like thisI'm aware the validator can be used standalone, but I'd need to do this in each and every Controller. Is there a simpler solution?
Beta Was this translation helpful? Give feedback.
All reactions