Skip to content

Instantly share code, notes, and snippets.

@biilmann
Created July 24, 2011 14:16
Show Gist options
  • Select an option

  • Save biilmann/1102659 to your computer and use it in GitHub Desktop.

Select an option

Save biilmann/1102659 to your computer and use it in GitHub Desktop.
JSON API in 8 lines
exports.get = {
"api/:section": function(params) {
response.send(site.content({from: params.section}));
},
"api/:section/entries": function(params) {
response.send(JSON.stringify(site.entries({from: params.section})), {"Content-Type": "application/json"});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment