'Router.router path param is empty
I have a API,created by val router = Router.router(vertx) router.patch("/api/v2/user/:userId/names")
if user id is not passed getting message - "error": "Page not found: /api/v2/user//names"
How can I give a default value if not passed or have another good idea?
Solution 1:[1]
You can't give a default value, you have to define another route.
val router = Router.router(vertx)
router.patch("/api/v2/user/names")
router.patch("/api/v2/user/:userId/names")
From a REST API design perspective, these are two different resources.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |