I'm pretty new to Scala and came from Java and got confused by some piece of code when reading this documentation. Here is the code.
val route =
path("hello") {
get {
complete(HttpEntity(ContentTypes.`text/html(UTF-8)`, "<h1>Say hello to akka-http</h1>"))
}
}
Where path("hello") is the method of trait:
trait PathDirectives /*extends omitted*/ {
def path[L](pm: PathMatcher[L]): Directive[L] = pathPrefix(pm ~ PathEnd)
// the rest omitted
}
So, when we invoke the path("hello") method we would need an object implementing the trait to invoke it on. But in the example it was just a method invocation. Just like a static method.
What did I miss?