Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/*
I want to be able to build a DSL for node.js so that I can define app routes for an HTTP interface like this:
*/
{
"/blog" : {
GET: function(request) {
// List blog posts
},
POST: function(request) {
// Create blog post
}
},
"/blog/:post" : {
GET: function(request) {
// Display :post
},
PUT: function(request) {
// Update :post
}
DELETE: function(request) {
// Delete :post
}
},
"/blog/:post/comments" : {
GET: function(request) {
// List comments for :post
},
POST: function(request) {
// Add comment for :post
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment