Last active
December 20, 2015 22:19
-
-
Save hhariri/6203987 to your computer and use it in GitHub Desktop.
manualconneg
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.get("/book", | |
{ | |
// automatic negotiation exists, but if you want manual... | |
negotiate { | |
on("text/html") {response.send("Something about everyone")} | |
on("application/json") { | |
// this is just a sample. automatic json serialization is also available... | |
response.send("{title: 'Something about everyone', isbn: 'IS454-12123-A23232'}") | |
} | |
} | |
} | |
) |
Use fecking sensible indentation and I'll read this properly
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is that legal json? I thought {"title":"Something about me", "isbn":"number"} was.