diff --git a/.gitignore b/.gitignore index 5267d4d5..371d08d2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,13 @@ -.settings -.buildpath -.project +*.swp +*.swo +doc +auth_info.js dist -.DS_Store - +.idea/ +tags +nbproject/ +development.js +spec/browser/autogen_suite.js +node_modules +tmtags +*.DS_Store diff --git a/lib/routers/regex_router.js b/lib/routers/regex_router.js deleted file mode 100644 index 17a16cb2..00000000 --- a/lib/routers/regex_router.js +++ /dev/null @@ -1,39 +0,0 @@ -var url = require('url'); - -var RegexRouter = module.exports = function() RegexRouter { - this.routes = []; - this.notFound = function(req, resp) { - resp.writeHeaders(404); - resp.end("Not found."); - }; -} - -/* [{route:/regex/, callback: function(req, resp){}}, - * {...}] */ -RegexRouter.prototype.setRoutes(routes) { - this.routes = routes; -} - -RegexRouter.prototype.map(route, callback) { - this.routes.push({route: route, callback: callback}) -} - -/* This should return the appropriate callback for this request - * And add AT LEAST this data to the request object passed into - * the callback. */ -RegexRouter.prototype.route(req, resp) { - var data = url.parse(req.url, true); - req.path = data.pathname; - req.params = data.query; - req.hostname = data.hostname; - - var matches; - for(var i = 0; ii= this.routes.length; i < ii; i++) { - if (matches = request.path.match(this.routes[i].route)) { - request.matches = matches; - return this.routes[i].callback(req, resp); - } - } - this.notFound(req, resp) -} -