Skip to content

Instantly share code, notes, and snippets.

@deanh
Last active August 29, 2015 14:01
Show Gist options
  • Save deanh/2509bcde8f30585fa66c to your computer and use it in GitHub Desktop.
Save deanh/2509bcde8f30585fa66c to your computer and use it in GitHub Desktop.
get("/a/:id", operation(getA)) {
val id = params("id")
val idType = params.getOrElse("id_type", "a_id")
new AsyncResult {
val is: Future[_] = resolveId(id, idType) flatMap { aid =>
val frm = future { s /*}oing something more in the real code */ }map { s =>
responseMetaData(s.id)
}
frm flatMap { rm =>
url(s"/endpoint", Map("aid" -> aid, "detail_id" -> rm.detail_id))
}
} rescue { case e => future { e } }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment