Slide 7
Slide 7 text
؆୯ͳ HTTP αʔό
val service = new Service[http.Request, http.Response] {
def apply(req: http.Request): Future[http.Response] = {
req.path match {
case "/hello" => Future.value(http.Response(Status.OK, "world"))
case _ => Future.value(http.Response(Status.NotFound))
}
}
}
Await.ready(Http.server.serve(":80", service))
4 αʔό Service Λ࣮͢Δ
4 τϥϯεϙʔτΛҙࣝ͢Δͷ serve ͢Δͱ͖͚ͩ