Skip to content
Browse files

Add support for OPTIONS calls

Add full alias for delete
  • Loading branch information...
1 parent 8fa361a commit d007918daa4009183a0187c900097b0d0ad16855 Paul Bowsher committed Aug 7, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/clacks.js
View
7 lib/clacks.js
@@ -9,6 +9,7 @@ function Clacks() {
PUT: {},
DELETE: {},
PATCH: {},
+ OPTIONS: {},
any: {}
};
this.routes = [];
@@ -39,14 +40,18 @@ Clacks.prototype.put = function (path, handler) {
this.add(path, handler, "PUT");
};
-Clacks.prototype.del = function (path, handler) {
+Clacks.prototype.del = Clacks.prototype.delete = function (path, handler) {
this.add(path, handler, "DELETE");
};
Clacks.prototype.patch = function (path, handler) {
this.add(path, handler, "PATCH");
};
+Clacks.prototype.options = function (path, handler) {
+ this.add(path, handler, "OPTIONS");
+};
+
Clacks.prototype.notFound = function (req, res) {
console.log("404 " + req.url);
var body = "resource '" + URL.parse(req.url).pathname + "' not found\n",

0 comments on commit d007918

Please sign in to comment.
Something went wrong with that request. Please try again.