Skip to content

Instantly share code, notes, and snippets.

@hhariri
Last active December 20, 2015 19:39
Show Gist options
  • Save hhariri/6184754 to your computer and use it in GitHub Desktop.
Save hhariri/6184754 to your computer and use it in GitHub Desktop.
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