in liftbook, there's an example of creating of a Req instance by using apply :

case Req(List("api", "expense", eid), "", GetRequest) =>
 () => showExpense(eid)
but when I look into api documentation, there are two apply() methods, but I don't know which one and how is ran in this example.

Also, is there a way, how to include /a/b and /a/b/c requests with one case ?

Also, is there a way, how to enumerate all possible requests in one case : guess : case Req(List("api", "expense", eid), "", {GetRequest,PostRequest})?

Thanks for answering.

有帮助吗?

解决方案

Judging by case, this isn't an example of creating a Req, but an example of pattern matching one.

Also, is there a way, how to enumerate all possible requests in one case

It should be

case Req(List("api", "expense", eid), "", _)

其他提示

I think you'd have to have a two tier pattern matching. On that would match the Req with any Request and extracts the request, and another that matches the specific request.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top