Skip to content

Instantly share code, notes, and snippets.

@dongw
dongw / rest.scala
Created February 24, 2012 15:29 — forked from robi42/rest.scala
Basic RESTful service with Finagle
class Respond extends Service[Request, Response] with Logger {
def apply(request: Request) = {
try {
request.method -> Path(request.path) match {
case GET -> Root / "todos" => Future.value {
val data = Todos.allAsJson
debug("data: %s" format data)
Responses.json(data, acceptsGzip(request))
}
case GET -> Root / "todos" / id => Future.value {