【发布时间】:2019-06-13 14:52:48
【问题描述】:
我有一个类似于以下在 HTTP4K 中运行良好的路由。然而,不得不重复调用 "/" bind 很烦人。我一直在寻找一种更简单的方式来表达 DSL,但似乎没有其他方法。有什么方法可以实现吗?
routes(
"/things" bind routes(
"/" bind Method.GET to allThings,
"/{id:.*}" bind routes (
"/" bind Method.GET to singleThing,
"/" bind Method.DELETE to deleteThing,
"/" bind Method.PUT to addOrUpdateThing
)
)
).asServer(Netty(8080))
.start()
【问题讨论】: