A few pieces of information that might help when looking at code like this:
- Calling an object or class as a function calls the appropriate apply method if there is one
- Parentheses are often optional
so another way to rewrite the code above would be:
val route = HttpService.apply({
case GET -> Root / "hello" =>
Ok("Hello world.")
})
As noted in Diego’s answer, the function passed to apply in this case goes from some sort of HTTP request to some sort of HTTP response.
0
solved What does this mean in Scala? [closed]