Skip to content

Instantly share code, notes, and snippets.

@robi42
Created June 6, 2010 11:58
Show Gist options
  • Save robi42/427546 to your computer and use it in GitHub Desktop.
Save robi42/427546 to your computer and use it in GitHub Desktop.
// an-app/config.js
// [...]
exports.urls = ["./actions"]; // Simply an array of module names now.
// an-app/actions.js
// [...]
// GET /documents
exports.GET['/documents'] = function (req) {
// Do something.
};
// GET /documents/{id} (IDs as in 1, 2, 3, ...)
exports.GET['/documents/([1-9]\\d*)'] = function (req, id) {
// Do something.
};
// POST /documents/{id}
exports.POST['/documents/([1-9]\\d*)'] = function (req, id) {
// Do something.
};
// PUT /documents/{id}
exports.PUT['/documents/([1-9]\\d*)'] = function (req, id) {
// Do something.
};
// DELETE /documents/{id}
exports.DEL['/documents/([1-9]\\d*)'] = function (req, id) {
// Do something.
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment