読者です 読者をやめる 読者になる 読者になる

by shigemk2

当面は技術的なことしか書かない

HTTPステータスコード 200/400/500を返すだけのPlay Framework

Scala Play Framework

github.com

ほんとうにただそれだけ。

$ curl -v http://localhost:9000/ok
*   Trying ::1...
* Connected to localhost (::1) port 9000 (#0)
> GET /ok HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: text/plain
< Date: Thu, 11 Feb 2016 12:36:59 GMT
< Content-Length: 3
<
* Connection #0 to host localhost left intact
OK!
$ curl -v http://localhost:9000/bad
*   Trying ::1...
* Connected to localhost (::1) port 9000 (#0)
> GET /bad HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 400 Bad Request
< Content-Type: text/plain
< Date: Thu, 11 Feb 2016 12:37:26 GMT
< Content-Length: 12
<
* Connection #0 to host localhost left intact
Bad Request!
$ curl -v http://localhost:9000/error
*   Trying ::1...
* Connected to localhost (::1) port 9000 (#0)
> GET /error HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 500 Internal Server Error
< Content-Type: text/plain
< Date: Thu, 11 Feb 2016 12:37:41 GMT
< Content-Length: 22
<
* Connection #0 to host localhost left intact
Internal Server Error!

ScalaActions

正直、コーディングよりコンパイルのほうに時間がかかったような気がするのです。