router.router路径参数为空
我有一个API,由 val Router = Router.Router(vertx)创建 router.patch(“/api/v2/user/:userId/names”)
未传递用户ID获取消息 - “错误”:
如果 如果不通过或有另一个好主意,则默认值?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能给出默认值,必须定义另一个路线。
从REST API设计的角度来看,这是两个不同的资源。
You can't give a default value, you have to define another route.
From a REST API design perspective, these are two different resources.