Skip to content

Instantly share code, notes, and snippets.

@hhariri
Last active December 20, 2015 22:19
Show Gist options
  • Select an option

  • Save hhariri/6203987 to your computer and use it in GitHub Desktop.

Select an option

Save hhariri/6203987 to your computer and use it in GitHub Desktop.
manualconneg
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'}")
}
}
}
)
@chrissie1
Copy link
Copy Markdown

Is that legal json? I thought {"title":"Something about me", "isbn":"number"} was.

@robashton
Copy link
Copy Markdown

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