Created
June 17, 2012 20:50
-
-
Save j2labs/2945706 to your computer and use it in GitHub Desktop.
Rollin down the street, rolling braces, sippin on gin n juice. Laid back. With my braces on one line and one line for my braces.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val service = { | |
path("orders") { | |
authenticate(httpBasic(realm = "admin area")) { user => | |
get { | |
cacheResults(LruCache(maxCapacity = 1000, timeToIdle = Some(30.minutes))) { | |
encodeResponse(Deflate) { | |
completeWith { | |
// marshal custom object with in-scope marshaller | |
getOrdersFromDB}}}} ~ | |
post { | |
(decodeRequest(Gzip) | decodeRequest(NoEncoding)) { | |
// unmarshal with in-scope unmarshaller | |
content(as[Order]) { order => | |
// transfer to newly spawned actor | |
detach { | |
completeWith { | |
// ... write order to DB | |
"Order received"}}}}}}} ~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment