Last active
December 20, 2015 19:39
-
-
Save hhariri/6184754 to your computer and use it in GitHub Desktop.
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
server.conneg() { | |
onAcceptHeader() | |
onExtension() | |
onQueryParameter("format") | |
} | |
server.get("/customer/:id", | |
{ | |
// do generic stuff here like look up customer etc... | |
response.setCacheControl(CacheControl.NoCache) | |
// then do specifics below.... | |
negotiate { | |
"text/plain" to { response.send("Joe Smith") }, | |
"image/jpeg" to { response.streamFile("/joesmith.jpg")} | |
} | |
} | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment