{"_id":"urlrouter","_rev":"29-b2513856225bb2e8c557dac92a4248da","name":"urlrouter","description":"connect missing router middleware, support express format routing.","dist-tags":{"latest":"0.5.4"},"versions":{"0.1.0":{"author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"name":"urlrouter","description":"connect missing router middleware.","version":"0.1.0","homepage":"http://github.com/fengmk2/connect-router","repository":{"url":"git://github.com/fengmk2/connect-router.git"},"main":"index.js","scripts":{"test":"make test"},"dependencies":{},"devDependencies":{"mocha":"*","should":"*","rewire":"*","connect":">=1.8.0"},"optionalDependencies":{},"engines":{"node":">=0.6.7"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"_id":"urlrouter@0.1.0","_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.17","_defaultsLoaded":true,"dist":{"shasum":"3a76d254cf24c105d689ee1e6a4d9b36a78d3384","tarball":"https://registry.npmjs.org/urlrouter/-/urlrouter-0.1.0.tgz","integrity":"sha512-Z00p0OT/a0CCM18GrrIeSTuHRnB8Y1eEWlYCiVIePBSbI+rZyxQri9+L94Rs4Ih8yASdXmHvB02UtCSJUjn4cA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFBYOWAFmIs7X86nlCjdHWBpSya+/zx+9mfUPcwOmwWZAiEA8M6N7pyXvZMYI01xakTr5jDQC6yYvMP9L3hrB+2gTVs="}]},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"directories":{}},"0.2.0":{"name":"urlrouter","description":"connect missing router middleware.","keywords":["router","url","connect","middleware","express"],"version":"0.2.0","homepage":"http://github.com/fengmk2/connect-router","author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"repository":{"url":"git://github.com/fengmk2/connect-router.git"},"main":"index.js","scripts":{"test":"make test-version"},"dependencies":{},"devDependencies":{"mocha":"*","should":"*","rewire":"*","connect":">=1.8.0"},"optionalDependencies":{},"engines":{"node":">=0.6.7"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"_id":"urlrouter@0.2.0","_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.17","_defaultsLoaded":true,"dist":{"shasum":"b8f2c450b026b7a5a87661389ea54a0ff903a7a7","tarball":"https://registry.npmjs.org/urlrouter/-/urlrouter-0.2.0.tgz","integrity":"sha512-fhYJqo+J7WFseKtSSUiPntaYF6NeRfsiRdKG0MZH/BKWPauKsqx+mFqzy635KxrBOXuSRlmvw/NPTET0W+oaSA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBq+Dirv+Wp9amg2c3ZMoLiGo4m5qCs00GUWzJqdxv4yAiEAnmT6mX8G3Nk5WHX6ACDyUQps/QulCuSaVt+D4xXZ+Lg="}]},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"directories":{}},"0.2.1":{"name":"urlrouter","description":"connect missing router middleware, support express format routing.","keywords":["router","url","connect","middleware","express"],"version":"0.2.1","homepage":"http://github.com/fengmk2/urlrouter","author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"repository":{"url":"git://github.com/fengmk2/urlrouter.git","type":"git"},"bugs":{"url":"http://github.com/fengmk2/urlrouter/issues"},"main":"index.js","scripts":{"test":"make test-version"},"dependencies":{},"devDependencies":{"mocha":"*","should":"*","rewire":"*","connect":">=1.8.0"},"optionalDependencies":{},"engines":{"node":">=0.6.7"},"readme":"# urlrouter\n\n[![Build Status](https://secure.travis-ci.org/fengmk2/urlrouter.png)](http://travis-ci.org/fengmk2/urlrouter)\n\n`http` url router.\n\n[connect](https://github.com/senchalabs/connect) missing router middleware.\n\nSupport [express](http://expressjs.com) format [routing](http://expressjs.com/guide.html#routing).\n\nSupport `connect` @1.8.x and @2.2.0+ .\n\n## Test connect version\n\n* 1.8.0+: 1.8.0 1.8.5 1.8.6 1.8.7 **1.9.0**\n* 2.2.0+: 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.2 **2.3.3**\n\n```bash\n$ make test-version\n```\n\ntest results: [test_results.md](https://github.com/fengmk2/urlrouter/blob/master/test_results.md)\n\njscoverage: [**100%**](http://fengmk2.github.com/coverage/urlrouter.html)\n\n## Install\n\n```bash\n$ npm install urlrouter\n```\n\n## Usage\n\n### Using with `connect`\n\n```javascript\nvar connect = require('connect');\nvar urlrouter = require('urlrouter');\n\nconnect(urlrouter(function (app) {\n  app.get('/', function (req, res, next) {\n    res.end('hello urlrouter');\n  });\n  app.get('/user/:id([0-9]+)', function (req, res, next) {\n    res.end('hello user ' + req.params.id);\n  });\n})).listen(3000);\n```\n\n### Using with `http.createServer()`\n\n```javascript\nvar http = require('http');\nvar urlrouter = require('urlrouter');\n\nvar options = {\n  pageNotFound: function (req, res) {\n    res.statusCode = 404;\n    res.end('er... some page miss...');\n  }\n};\n\nvar router = urlrouter(function (app) {\n  app.get('/', function (req, res) {\n    res.end('GET home page' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.get('/user/:id', function (req, res) {\n    res.end('user: ' + req.params.id);\n  });\n\n  app.get(/^\\/users?(?:\\/(\\d+)(?:\\.\\.(\\d+))?)?/, function (req, res) {\n    res.end(req.url + ' : ' + req.params);\n  });\n\n  app.get('/foo', function (req, res) {\n    res.end('GET ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.post('/new', function (req, res) {\n    res.write('POST ' + req.url + ' start...\\n\\n');\n    var counter = 0;\n    req.on('data', function (data) {\n      counter++;\n      res.write('data' + counter + ': ' + data.toString() + '\\n\\n');\n    });\n    req.on('end', function () {\n      res.end('POST ' + req.url + ' end.\\n');\n    });\n  });\n\n  app.put('/update', function (req, res) {\n    res.end('PUT ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.delete('/remove', function (req, res) {\n    res.end('DELETE ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.options('/check', function (req, res) {\n    res.end('OPTIONS ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n}, options);\n\nhttp.createServer(router).listen(3000);\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 fengmk2 <fengmk2@gmail.com>.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"urlrouter@0.2.1","dist":{"shasum":"cad94cb22b3a4f2e574a66c17d585778982b11b2","tarball":"https://registry.npmjs.org/urlrouter/-/urlrouter-0.2.1.tgz","integrity":"sha512-ROlf9mBxdk8gVPzaWwBf6Wp3IyU/bXscZU5Z+gmdkYzbZHF5EpTdj4Acg5Nofi6cbiGuaycjsaJnyzYK2fj2/A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBpJYBGrq6ECBmteW5pOzEOu5bNT6KzLh5fHNtoP9it8AiEA/cTnxTIuOEuc/tGY/2PjPeS4wWO0nApnqn8kC55CoXY="}]},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}]},"0.2.3":{"name":"urlrouter","description":"connect missing router middleware, support express format routing.","keywords":["router","url","connect","middleware","express"],"version":"0.2.3","homepage":"http://github.com/fengmk2/urlrouter","author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"repository":{"url":"git://github.com/fengmk2/urlrouter.git","type":"git"},"bugs":{"url":"http://github.com/fengmk2/urlrouter/issues"},"main":"index.js","scripts":{"test":"make test-version"},"dependencies":{},"devDependencies":{"mocha":"*","should":"*","rewire":"*","connect":">=1.8.0"},"optionalDependencies":{},"engines":{"node":">=0.6.7"},"contributors":[{"name":"fengmk2","email":"fengmk2@gmail.com","url":"https://github.com/fengmk2"},{"name":"rockdai","email":"rockdai@qq.com","url":"https://github.com/rockdai"}],"readme":"# urlrouter\n\n[![Build Status](https://secure.travis-ci.org/fengmk2/urlrouter.png)](http://travis-ci.org/fengmk2/urlrouter)\n\n`http` url router.\n\n[connect](https://github.com/senchalabs/connect) missing router middleware.\n\nSupport [express](http://expressjs.com) format [routing](http://expressjs.com/guide.html#routing).\n\nSupport `connect` @1.8.x and @2.2.0+ .\n\n## Test connect version\n\n* 1.8.0+: 1.8.0 1.8.5 1.8.6 1.8.7\n* 1.9.0+\n* 2.2.0+\n* 2.3.0+\n* 2.4.0+\n\n```bash\n$ make test-version\n```\n\ntest results: [test_results.md](https://github.com/fengmk2/urlrouter/blob/master/test_results.md)\n\njscoverage: [**100%**](http://fengmk2.github.com/coverage/urlrouter.html)\n\n## Install\n\n```bash\n$ npm install urlrouter\n```\n\n## Usage\n\n### Using with `connect`\n\n```javascript\nvar connect = require('connect');\nvar urlrouter = require('urlrouter');\n\nconnect(urlrouter(function (app) {\n  app.get('/', function (req, res, next) {\n    res.end('hello urlrouter');\n  });\n  app.get('/user/:id([0-9]+)', function (req, res, next) {\n    res.end('hello user ' + req.params.id);\n  });\n})).listen(3000);\n```\n\nSeveral callbacks may also be passed.\n\n```javascript\n\nfunction loadUser(req, res, next) {\n  // You would fetch user from the db\n  var user = users[req.params.id];\n  if (user) {\n    req.user = user;\n    next();\n  } else {\n    next(new Error('Failed to load user ' + req.params.id));\n  }\n}\n\napp.get('/user/:id', loadUser, function () {\n  // ...\n});\n```\n\nThese callbacks can be passed within arrays as well.\n\n```javascript\nvar middleware = [loadUser, [loadForum, loadThread]];\napp.post('/forum/:fid/thread/:tid', middleware, function () {\n // ...\n});\n```\n\n### Using with `http.createServer()`\n\n```javascript\nvar http = require('http');\nvar urlrouter = require('urlrouter');\n\nvar options = {\n  pageNotFound: function (req, res) {\n    res.statusCode = 404;\n    res.end('er... some page miss...');\n  },\n  errorHandler: function (req, res) {\n    res.statusCode = 500;\n    res.end('oops..error occurred');\n  }\n};\n\nfunction loadUser(req, res, next) {\n  // You would fetch user from the db\n  var user = users[req.params.id];\n  if (user) {\n    req.user = user;\n    next();\n  } else {\n    next(new Error('Failed to load user ' + req.params.id));\n  }\n}\n\nvar router = urlrouter(function (app) {\n  app.get('/', function (req, res) {\n    res.end('GET home page' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n  // with route middleware\n  app.get('/user/:id', loadUser, function (req, res) {\n    res.end('user: ' + req.params.id);\n  });\n\n  app.get(/^\\/users?(?:\\/(\\d+)(?:\\.\\.(\\d+))?)?/, loadUser, function (req, res) {\n    res.end(req.url + ' : ' + req.params);\n  });\n\n  app.get('/foo', function (req, res) {\n    res.end('GET ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.post('/new', function (req, res) {\n    res.write('POST ' + req.url + ' start...\\n\\n');\n    var counter = 0;\n    req.on('data', function (data) {\n      counter++;\n      res.write('data' + counter + ': ' + data.toString() + '\\n\\n');\n    });\n    req.on('end', function () {\n      res.end('POST ' + req.url + ' end.\\n');\n    });\n  });\n\n  app.put('/update', function (req, res) {\n    res.end('PUT ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.delete('/remove', function (req, res) {\n    res.end('DELETE ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.options('/check', function (req, res) {\n    res.end('OPTIONS ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n}, options);\n\nhttp.createServer(router).listen(3000);\n```\n\n## Contributors\nOrdered by date of first contribution.\n[Auto-generated](http://github.com/dtrejo/node-authors) on Thu Sep 13 2012 10:49:38 GMT+0800 (CST).\n\n- [fengmk2](https://github.com/fengmk2)\n- [rockdai](https://github.com/rockdai)\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 fengmk2 <fengmk2@gmail.com>.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"urlrouter@0.2.3","dist":{"shasum":"c4000e6812b99a615e30301063c3470939769698","tarball":"https://registry.npmjs.org/urlrouter/-/urlrouter-0.2.3.tgz","integrity":"sha512-h1/MAc6okTOdjYNQE9rY5aSh760c6DrFBndS0uP3J0jAYaX4eEHaBRv8MbGYAAkrn+dvT4GcRNVzxEtrNDAMnQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC99dhzzqADFxDAwkowmCcJZCjptC/e2NgXemAXGf9YzgIgBTPQSuOval1YIJSs4G40swPTWzyHQL70N/RyQUBTxOE="}]},"_npmVersion":"1.1.61","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}]},"0.3.0":{"name":"urlrouter","description":"connect missing router middleware, support express format routing.","keywords":["router","url","connect","middleware","express"],"version":"0.3.0","homepage":"http://github.com/fengmk2/urlrouter","author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"repository":{"url":"git://github.com/fengmk2/urlrouter.git","type":"git"},"bugs":{"url":"http://github.com/fengmk2/urlrouter/issues"},"main":"index.js","scripts":{"test":"make test-version"},"dependencies":{},"devDependencies":{"mocha":"*","should":"*","supertest":"*","pedding":"*","jscover":"*","connect":">=1.8.0"},"optionalDependencies":{},"engines":{"node":">=0.6.7"},"contributors":[{"name":"fengmk2","email":"fengmk2@gmail.com","url":"https://github.com/fengmk2"},{"name":"rockdai","email":"rockdai@qq.com","url":"https://github.com/rockdai"}],"readme":"# urlrouter [![Build Status](https://secure.travis-ci.org/fengmk2/urlrouter.png)](http://travis-ci.org/fengmk2/urlrouter)\n\n![logo](https://raw.github.com/fengmk2/urlrouter/master/logo.png)\n\n`http` url router.\n\n[connect](https://github.com/senchalabs/connect) missing router middleware.\n\nSupport [express](http://expressjs.com) format [routing](http://expressjs.com/guide.html#routing).\n\nSupport `connect` @1.8.x and @2.2.0+ .\n\n## Test connect version\n\n* 1.8.0+: 1.8.0 1.8.5 1.8.6 1.8.7\n* 1.9.0+\n* 2.2.0+\n* 2.3.0+\n* 2.4.0+\n* 2.7.0+\n\n```bash\n$ make test-version\n```\n\ntest results: [test_results.md](https://github.com/fengmk2/urlrouter/blob/master/test_results.md)\n\njscoverage: [**100%**](http://fengmk2.github.com/coverage/urlrouter.html)\n\n## Install\n\n```bash\n$ npm install urlrouter\n```\n\n## Usage\n\n### Using with `connect`\n\n```javascript\nvar connect = require('connect');\nvar urlrouter = require('urlrouter');\n\nconnect(urlrouter(function (app) {\n  app.get('/', function (req, res, next) {\n    res.end('hello urlrouter');\n  });\n  app.get('/user/:id([0-9]+)', function (req, res, next) {\n    res.end('hello user ' + req.params.id);\n  });\n})).listen(3000);\n```\n\nSeveral callbacks may also be passed.\n\n```javascript\n\nfunction loadUser(req, res, next) {\n  // You would fetch user from the db\n  var user = users[req.params.id];\n  if (user) {\n    req.user = user;\n    next();\n  } else {\n    next(new Error('Failed to load user ' + req.params.id));\n  }\n}\n\napp.get('/user/:id', loadUser, function () {\n  // ...\n});\n```\n\nThese callbacks can be passed within arrays as well.\n\n```javascript\nvar middleware = [loadUser, [loadForum, loadThread]];\napp.post('/forum/:fid/thread/:tid', middleware, function () {\n // ...\n});\n```\n\n### Using with `http.createServer()`\n\n```javascript\nvar http = require('http');\nvar urlrouter = require('urlrouter');\n\nvar options = {\n  pageNotFound: function (req, res) {\n    res.statusCode = 404;\n    res.end('er... some page miss...');\n  },\n  errorHandler: function (req, res) {\n    res.statusCode = 500;\n    res.end('oops..error occurred');\n  }\n};\n\nfunction loadUser(req, res, next) {\n  // You would fetch user from the db\n  var user = users[req.params.id];\n  if (user) {\n    req.user = user;\n    next();\n  } else {\n    next(new Error('Failed to load user ' + req.params.id));\n  }\n}\n\nvar routerMiddleware = urlrouter(function (app) {\n  app.get('/', function (req, res) {\n    res.end('GET home page' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n  // with route middleware\n  app.get('/user/:id', loadUser, function (req, res) {\n    res.end('user: ' + req.params.id);\n  });\n\n  app.get(/^\\/users?(?:\\/(\\d+)(?:\\.\\.(\\d+))?)?/, loadUser, function (req, res) {\n    res.end(req.url + ' : ' + req.params);\n  });\n\n  app.get('/foo', function (req, res) {\n    res.end('GET ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.post('/new', function (req, res) {\n    res.write('POST ' + req.url + ' start...\\n\\n');\n    var counter = 0;\n    req.on('data', function (data) {\n      counter++;\n      res.write('data' + counter + ': ' + data.toString() + '\\n\\n');\n    });\n    req.on('end', function () {\n      res.end('POST ' + req.url + ' end.\\n');\n    });\n  });\n\n  app.put('/update', function (req, res) {\n    res.end('PUT ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.delete('/remove', function (req, res) {\n    res.end('DELETE ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.options('/check', function (req, res) {\n    res.end('OPTIONS ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.all('/all', function (req, res) {\n    res.end('ALL methods request /all should be handled' + ' , headers: ' + JSON.stringify(req.headers));\n  });\n}, options);\n\nhttp.createServer(routerMiddleware).listen(3000);\n```\n\n## Contributors\n\n```bash\n$ git summary \n\n project  : urlrouter\n repo age : 10 months\n active   : 12 days\n commits  : 27\n files    : 19\n authors  : \n    22  fengmk2                 81.5%\n     4  rockdai                 14.8%\n     1  rock                    3.7%\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 - 2013 fengmk2 <fengmk2@gmail.com>.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","readmeFilename":"README.md","_id":"urlrouter@0.3.0","dist":{"shasum":"8f0a6e358368fdb8c78320ce928807080257c18b","tarball":"https://registry.npmjs.org/urlrouter/-/urlrouter-0.3.0.tgz","integrity":"sha512-cNUjdRPPLnSxnJsOiK+Bhk3lIjoqr5yUMWN8sVrxSlibAGCOSMxGN19EPdGhsnrsX//VKcjw9zN8ZwMtjW9Mog==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAeHHtU04cnrw4KYoT/XPA+pARt+kqKzlV29Arowmj6uAiAn5NQXT9cKlIm0l+vo36FdqTCTBCchGb4pbObnxK0vng=="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}]},"0.4.0":{"name":"urlrouter","description":"connect missing router middleware, support express format routing.","keywords":["router","url","connect","middleware","express"],"version":"0.4.0","homepage":"http://github.com/fengmk2/urlrouter","author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"repository":{"url":"git://github.com/fengmk2/urlrouter.git","type":"git"},"bugs":{"url":"http://github.com/fengmk2/urlrouter/issues"},"main":"index.js","scripts":{"test":"make test-version","blanket":{"pattern":"urlrouter/lib","data-cover-flags":{"debug":false}},"travis-cov":{"threshold":100}},"dependencies":{"methods":"0.0.1"},"devDependencies":{"mocha":"*","should":"*","supertest":"*","pedding":"*","blanket":"*","travis-cov":"*","connect":">=1.8.0"},"optionalDependencies":{},"engines":{"node":">=0.6.7"},"contributors":[{"name":"fengmk2","email":"fengmk2@gmail.com","url":"https://github.com/fengmk2"},{"name":"rockdai","email":"rockdai@qq.com","url":"https://github.com/rockdai"}],"readme":"# urlrouter [![Build Status](https://secure.travis-ci.org/fengmk2/urlrouter.png)](http://travis-ci.org/fengmk2/urlrouter)\n\n![logo](https://raw.github.com/fengmk2/urlrouter/master/logo.png)\n\n`http` url router.\n\n[connect](https://github.com/senchalabs/connect) missing router middleware.\n\nSupport [express](http://expressjs.com) format [routing](http://expressjs.com/guide.html#routing).\n\nSupport `connect` @1.8.x and @2.2.0+ .\n\n## Test connect version\n\n* 1.8.0+: 1.8.0 1.8.5 1.8.6 1.8.7\n* 1.9.0+\n* 2.2.0+\n* 2.3.0+\n* 2.4.0+\n* 2.7.0+\n\n```bash\n$ make test-version\n```\n\ntest results: [test_results.md](https://github.com/fengmk2/urlrouter/blob/master/test_results.md)\n\njscoverage: [**100%**](http://fengmk2.github.com/coverage/urlrouter.html)\n\n## Install\n\n```bash\n$ npm install urlrouter\n```\n\n## Usage\n\n### Using with `connect`\n\n```javascript\nvar connect = require('connect');\nvar urlrouter = require('urlrouter');\n\nconnect(urlrouter(function (app) {\n  app.get('/', function (req, res, next) {\n    res.end('hello urlrouter');\n  });\n  app.get('/user/:id([0-9]+)', function (req, res, next) {\n    res.end('hello user ' + req.params.id);\n  });\n})).listen(3000);\n```\n\nSeveral callbacks may also be passed.\n\n```js\n\nfunction loadUser(req, res, next) {\n  // You would fetch user from the db\n  var user = users[req.params.id];\n  if (user) {\n    req.user = user;\n    next();\n  } else {\n    next(new Error('Failed to load user ' + req.params.id));\n  }\n}\n\napp.get('/user/:id', loadUser, function () {\n  // ...\n});\n```\n\nThese callbacks can be passed within arrays as well.\n\n```js\nvar middleware = [loadUser, loadForum, loadThread];\napp.post('/forum/:fid/thread/:tid', middleware, function () {\n // ...\n});\n```\n\n### Using with `http.createServer()`\n\n```js\nvar http = require('http');\nvar urlrouter = require('urlrouter');\n\nvar options = {\n  pageNotFound: function (req, res) {\n    res.statusCode = 404;\n    res.end('er... some page miss...');\n  },\n  errorHandler: function (req, res) {\n    res.statusCode = 500;\n    res.end('oops..error occurred');\n  }\n};\n\nfunction loadUser(req, res, next) {\n  // You would fetch user from the db\n  var user = users[req.params.id];\n  if (user) {\n    req.user = user;\n    next();\n  } else {\n    next(new Error('Failed to load user ' + req.params.id));\n  }\n}\n\nvar routerMiddleware = urlrouter(function (app) {\n  app.get('/', function (req, res) {\n    res.end('GET home page' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n  // with route middleware\n  app.get('/user/:id', loadUser, function (req, res) {\n    res.end('user: ' + req.params.id);\n  });\n\n  app.get(/^\\/users?(?:\\/(\\d+)(?:\\.\\.(\\d+))?)?/, loadUser, function (req, res) {\n    res.end(req.url + ' : ' + req.params);\n  });\n\n  app.get('/foo', function (req, res) {\n    res.end('GET ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.post('/new', function (req, res) {\n    res.write('POST ' + req.url + ' start...\\n\\n');\n    var counter = 0;\n    req.on('data', function (data) {\n      counter++;\n      res.write('data' + counter + ': ' + data.toString() + '\\n\\n');\n    });\n    req.on('end', function () {\n      res.end('POST ' + req.url + ' end.\\n');\n    });\n  });\n\n  app.put('/update', function (req, res) {\n    res.end('PUT ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.delete('/remove', function (req, res) {\n    res.end('DELETE ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.options('/check', function (req, res) {\n    res.end('OPTIONS ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.all('/all', function (req, res) {\n    res.end('ALL methods request /all should be handled' + ' , headers: ' + JSON.stringify(req.headers));\n  });\n}, options);\n\nhttp.createServer(routerMiddleware).listen(3000);\n```\n\n## Contributors\n\n```bash\n$ git summary \n\n project  : urlrouter\n repo age : 10 months\n active   : 12 days\n commits  : 27\n files    : 19\n authors  : \n    22  fengmk2                 81.5%\n     4  rockdai                 14.8%\n     1  rock                    3.7%\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 - 2013 fengmk2 <fengmk2@gmail.com>.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","readmeFilename":"README.md","_id":"urlrouter@0.4.0","dist":{"shasum":"65f301d950b81d77a4b974f2b09c07f2e74992a3","tarball":"https://registry.npmjs.org/urlrouter/-/urlrouter-0.4.0.tgz","integrity":"sha512-wlwVSaoKCWTnHlosMqXKkzpii34izHiD6ck4SpsA9Ii2Jrz+T6n+9xFKOFt529WjiEpTK1VgbcrkSmRoKDRlIw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCByj2nquOP3N2HtHZ4q15pnsvDHjDoSsXHCv5h3E412AIhAP8Km/Cw8ghJwLoV4iMEAR9Vp4WlHysjlTtVv/qaAooF"}]},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}]},"0.5.0":{"name":"urlrouter","description":"connect missing router middleware, support express format routing.","keywords":["router","url","connect","middleware","express"],"version":"0.5.0","homepage":"http://github.com/fengmk2/urlrouter","author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"repository":{"url":"git://github.com/fengmk2/urlrouter.git","type":"git"},"bugs":{"url":"http://github.com/fengmk2/urlrouter/issues"},"main":"index.js","scripts":{"test":"make test-all"},"dependencies":{"methods":"0.0.1"},"devDependencies":{"mocha":"*","should":"*","supertest":"*","pedding":"*","blanket":"*","travis-cov":"*","coveralls":"*","mocha-lcov-reporter":"*","connect":">=1.8.0"},"engines":{"node":">=0.6.7"},"contributors":[{"name":"fengmk2","email":"fengmk2@gmail.com","url":"https://github.com/fengmk2"},{"name":"rockdai","email":"rockdai@qq.com","url":"https://github.com/rockdai"}],"readme":"# urlrouter [![Build Status](https://secure.travis-ci.org/fengmk2/urlrouter.png)](http://travis-ci.org/fengmk2/urlrouter) [![Coverage Status](https://coveralls.io/repos/fengmk2/urlrouter/badge.png)](https://coveralls.io/r/fengmk2/urlrouter)\n\n![logo](https://raw.github.com/fengmk2/urlrouter/master/logo.png)\n\n`http` url router.\n\n[connect](https://github.com/senchalabs/connect) missing router middleware.\n\nSupport [express](http://expressjs.com) format [routing](http://expressjs.com/guide.html#routing).\n\nSupport `connect` @1.8.x and @2.2.0+ .\n\n## Test connect version\n\n* 1.8.0+: 1.8.0 1.8.5 1.8.6 1.8.7\n* 1.9.0+\n* 2.2.0+\n* 2.3.0+\n* 2.4.0+\n* 2.7.0+\n\n```bash\n$ make test-version\n```\n\ntest results: [test_results.md](https://github.com/fengmk2/urlrouter/blob/master/test_results.md)\n\njscoverage: [**100%**](http://fengmk2.github.com/coverage/urlrouter.html)\n\n## Install\n\n```bash\n$ npm install urlrouter\n```\n\n## Usage\n\n### Using with `connect`\n\n```js\nvar connect = require('connect');\nvar urlrouter = require('urlrouter');\n\nconnect(urlrouter(function (app) {\n  app.get('/', function (req, res, next) {\n    res.end('hello urlrouter');\n  });\n  app.get('/user/:id([0-9]+)', function (req, res, next) {\n    res.end('hello user ' + req.params.id);\n  });\n})).listen(3000);\n```\n\nSeveral callbacks may also be passed.\n\n```js\n\nfunction loadUser(req, res, next) {\n  // You would fetch user from the db\n  var user = users[req.params.id];\n  if (user) {\n    req.user = user;\n    next();\n  } else {\n    next(new Error('Failed to load user ' + req.params.id));\n  }\n}\n\napp.get('/user/:id', loadUser, function () {\n  // ...\n});\n```\n\nThese callbacks can be passed within arrays as well.\n\n```js\nvar middleware = [loadUser, loadForum, loadThread];\napp.post('/forum/:fid/thread/:tid', middleware, function () {\n // ...\n});\n```\n\n### Using with `http.createServer()`\n\n```js\nvar http = require('http');\nvar urlrouter = require('urlrouter');\n\nvar options = {\n  pageNotFound: function (req, res) {\n    res.statusCode = 404;\n    res.end('er... some page miss...');\n  },\n  errorHandler: function (req, res) {\n    res.statusCode = 500;\n    res.end('oops..error occurred');\n  }\n};\n\nfunction loadUser(req, res, next) {\n  // You would fetch user from the db\n  var user = users[req.params.id];\n  if (user) {\n    req.user = user;\n    next();\n  } else {\n    next(new Error('Failed to load user ' + req.params.id));\n  }\n}\n\nvar routerMiddleware = urlrouter(function (app) {\n  app.get('/', function (req, res) {\n    res.end('GET home page' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n  // with route middleware\n  app.get('/user/:id', loadUser, function (req, res) {\n    res.end('user: ' + req.params.id);\n  });\n\n  // GET /admin 301 redirect to /admin/\n  app.redirect('/admin', '/admin/');\n\n  app.get(/^\\/users?(?:\\/(\\d+)(?:\\.\\.(\\d+))?)?/, loadUser, function (req, res) {\n    res.end(req.url + ' : ' + req.params);\n  });\n\n  app.get('/foo', function (req, res) {\n    res.end('GET ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.post('/new', function (req, res) {\n    res.write('POST ' + req.url + ' start...\\n\\n');\n    var counter = 0;\n    req.on('data', function (data) {\n      counter++;\n      res.write('data' + counter + ': ' + data.toString() + '\\n\\n');\n    });\n    req.on('end', function () {\n      res.end('POST ' + req.url + ' end.\\n');\n    });\n  });\n\n  app.put('/update', function (req, res) {\n    res.end('PUT ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.delete('/remove', function (req, res) {\n    res.end('DELETE ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.options('/check', function (req, res) {\n    res.end('OPTIONS ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.all('/all', function (req, res) {\n    res.end('ALL methods request /all should be handled' + ' , headers: ' + JSON.stringify(req.headers));\n  });\n}, options);\n\nhttp.createServer(routerMiddleware).listen(3000);\n```\n\n## Contributors\n\n```bash\n$ git summary \n\n project  : urlrouter\n repo age : 10 months\n active   : 12 days\n commits  : 27\n files    : 19\n authors  : \n    22  fengmk2                 81.5%\n     4  rockdai                 14.8%\n     1  rock                    3.7%\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 - 2013 fengmk2 <fengmk2@gmail.com>.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","readmeFilename":"README.md","_id":"urlrouter@0.5.0","dist":{"shasum":"61f76be0ef6a64b5a34699c17f16262c79655f49","tarball":"https://registry.npmjs.org/urlrouter/-/urlrouter-0.5.0.tgz","integrity":"sha512-p23axjz97WTycUzl5iJ02OwJsmlhr3PZNvTAu+OS46qSAQMqS/6PbUDP0VnG4n0jH0iGh56XwTaeERIn+quDmw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDa63NzXzPPnY9NTmWalBoLfZDQ/CrXzLYfNncPtvE+qQIhAOm+brDtFpYcGFlwHY1ICCUbZqpW8TEc2DLV4qNEt5In"}]},"_from":".","_npmVersion":"1.3.2","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}]},"0.5.1":{"name":"urlrouter","description":"connect missing router middleware, support express format routing.","keywords":["router","url","connect","middleware","express"],"version":"0.5.1","homepage":"http://github.com/fengmk2/urlrouter","author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"repository":{"url":"git://github.com/fengmk2/urlrouter.git","type":"git"},"bugs":{"url":"http://github.com/fengmk2/urlrouter/issues"},"main":"index.js","scripts":{"test":"make test-all"},"dependencies":{"methods":"0.0.1"},"devDependencies":{"mocha":"*","should":"*","supertest":"*","pedding":"*","blanket":"*","travis-cov":"*","coveralls":"*","mocha-lcov-reporter":"*","connect":">=1.8.0"},"engines":{"node":">=0.6.7"},"contributors":[{"name":"fengmk2","email":"fengmk2@gmail.com","url":"https://github.com/fengmk2"},{"name":"rockdai","email":"rockdai@qq.com","url":"https://github.com/rockdai"}],"readme":"# urlrouter [![Build Status](https://secure.travis-ci.org/fengmk2/urlrouter.png)](http://travis-ci.org/fengmk2/urlrouter) [![Coverage Status](https://coveralls.io/repos/fengmk2/urlrouter/badge.png)](https://coveralls.io/r/fengmk2/urlrouter)\n\n![logo](https://raw.github.com/fengmk2/urlrouter/master/logo.png)\n\n`http` url router.\n\n[connect](https://github.com/senchalabs/connect) missing router middleware.\n\nSupport [express](http://expressjs.com) format [routing](http://expressjs.com/guide.html#routing).\n\nSupport `connect` @1.8.x and @2.2.0+ .\n\n## Test connect version\n\n* 1.8.0+: 1.8.0 1.8.5 1.8.6 1.8.7\n* 1.9.0+\n* 2.2.0+\n* 2.3.0+\n* 2.4.0+\n* 2.7.0+\n* 2.8.0+\n\n```bash\n$ make test-all\n```\n\n## Install\n\n```bash\n$ npm install urlrouter\n```\n\n## Usage\n\n### Using with `connect`\n\n```js\nvar connect = require('connect');\nvar urlrouter = require('urlrouter');\n\nconnect(urlrouter(function (app) {\n  app.get('/', function (req, res, next) {\n    res.end('hello urlrouter');\n  });\n  app.get('/user/:id([0-9]+)', function (req, res, next) {\n    res.end('hello user ' + req.params.id);\n  });\n})).listen(3000);\n```\n\nSeveral callbacks may also be passed.\n\n```js\n\nfunction loadUser(req, res, next) {\n  // You would fetch user from the db\n  var user = users[req.params.id];\n  if (user) {\n    req.user = user;\n    next();\n  } else {\n    next(new Error('Failed to load user ' + req.params.id));\n  }\n}\n\napp.get('/user/:id', loadUser, function () {\n  // ...\n});\n```\n\nThese callbacks can be passed within arrays as well.\n\n```js\nvar middleware = [loadUser, loadForum, loadThread];\napp.post('/forum/:fid/thread/:tid', middleware, function () {\n // ...\n});\n```\n\n### Using with `http.createServer()`\n\n```js\nvar http = require('http');\nvar urlrouter = require('urlrouter');\n\nvar options = {\n  pageNotFound: function (req, res) {\n    res.statusCode = 404;\n    res.end('er... some page miss...');\n  },\n  errorHandler: function (req, res) {\n    res.statusCode = 500;\n    res.end('oops..error occurred');\n  }\n};\n\nfunction loadUser(req, res, next) {\n  // You would fetch user from the db\n  var user = users[req.params.id];\n  if (user) {\n    req.user = user;\n    next();\n  } else {\n    next(new Error('Failed to load user ' + req.params.id));\n  }\n}\n\nvar routerMiddleware = urlrouter(function (app) {\n  app.get('/', function (req, res) {\n    res.end('GET home page' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n  // with route middleware\n  app.get('/user/:id', loadUser, function (req, res) {\n    res.end('user: ' + req.params.id);\n  });\n\n  // GET /admin 301 redirect to /admin/\n  app.redirect('/admin', '/admin/');\n\n  app.get(/^\\/users?(?:\\/(\\d+)(?:\\.\\.(\\d+))?)?/, loadUser, function (req, res) {\n    res.end(req.url + ' : ' + req.params);\n  });\n\n  app.get('/foo', function (req, res) {\n    res.end('GET ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.post('/new', function (req, res) {\n    res.write('POST ' + req.url + ' start...\\n\\n');\n    var counter = 0;\n    req.on('data', function (data) {\n      counter++;\n      res.write('data' + counter + ': ' + data.toString() + '\\n\\n');\n    });\n    req.on('end', function () {\n      res.end('POST ' + req.url + ' end.\\n');\n    });\n  });\n\n  app.put('/update', function (req, res) {\n    res.end('PUT ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.delete('/remove', function (req, res) {\n    res.end('DELETE ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.options('/check', function (req, res) {\n    res.end('OPTIONS ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.all('/all', function (req, res) {\n    res.end('ALL methods request /all should be handled' + ' , headers: ' + JSON.stringify(req.headers));\n  });\n}, options);\n\nhttp.createServer(routerMiddleware).listen(3000);\n```\n\n## Contributors\n\n```bash\n$ git summary \n\n project  : urlrouter\n repo age : 1 year, 1 month\n active   : 16 days\n commits  : 38\n files    : 19\n authors  : \n    33  fengmk2                 86.8%\n     4  rockdai                 10.5%\n     1  rock                    2.6%\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 - 2013 fengmk2 <fengmk2@gmail.com>.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","readmeFilename":"README.md","_id":"urlrouter@0.5.1","dist":{"shasum":"3f75a8a73d9b58cb1d4aabafad77e56b1c9e298e","tarball":"https://registry.npmjs.org/urlrouter/-/urlrouter-0.5.1.tgz","integrity":"sha512-7HVLbMbPOMyYOxAArgW9jrfWxhVqHEQ6f2DY2cNqKVnGsDZf5zOVft4LCTDl/qf9hLUpBEcZy5BKTIcWccuF4w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFK7D1qEf0LmXgwmX0L8UqnkhE3RdtZsQDWCYJOvOB5PAiA5xE58I7oqAnkAXF4ToS2KZycNnuSOFZfshNb3/Dga+A=="}]},"_from":".","_npmVersion":"1.3.2","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}]},"0.5.2":{"name":"urlrouter","description":"connect missing router middleware, support express format routing.","keywords":["router","url","connect","middleware","express"],"version":"0.5.2","homepage":"http://github.com/fengmk2/urlrouter","author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"repository":{"url":"git://github.com/fengmk2/urlrouter.git","type":"git"},"bugs":{"url":"http://github.com/fengmk2/urlrouter/issues"},"main":"index.js","scripts":{"test":"make test-all"},"dependencies":{"methods":"0.0.1"},"devDependencies":{"mocha":"*","should":"*","supertest":"*","pedding":"*","blanket":"*","travis-cov":"*","coveralls":"*","mocha-lcov-reporter":"*","connect":">=1.8.0"},"engines":{"node":">=0.6.7"},"contributors":[{"name":"fengmk2","email":"fengmk2@gmail.com","url":"https://github.com/fengmk2"},{"name":"rockdai","email":"rockdai@qq.com","url":"https://github.com/rockdai"}],"readme":"# urlrouter [![Build Status](https://secure.travis-ci.org/fengmk2/urlrouter.png)](http://travis-ci.org/fengmk2/urlrouter) [![Coverage Status](https://coveralls.io/repos/fengmk2/urlrouter/badge.png)](https://coveralls.io/r/fengmk2/urlrouter)\n\n[![NPM](https://nodei.co/npm/urlrouter.png?downloads=true&stars=true)](https://nodei.co/npm/urlrouter/)\n\n![logo](https://raw.github.com/fengmk2/urlrouter/master/logo.png)\n\n`http` url router.\n\n[connect](https://github.com/senchalabs/connect) missing router middleware.\n\nSupport [express](http://expressjs.com) format [routing](http://expressjs.com/guide.html#routing).\n\nSupport `connect` @1.8.x and @2.2.0+ .\n\n## Test connect version\n\n* 1.8.0+: 1.8.0 1.8.5 1.8.6 1.8.7\n* 1.9.0+\n* 2.2.0+\n* 2.3.0+\n* 2.4.0+\n* 2.7.0+\n* 2.8.0+\n\n```bash\n$ make test-all\n```\n\n## Install\n\n```bash\n$ npm install urlrouter\n```\n\n## Usage\n\n### Using with `connect`\n\n```js\nvar connect = require('connect');\nvar urlrouter = require('urlrouter');\n\nconnect(urlrouter(function (app) {\n  app.get('/', function (req, res, next) {\n    res.end('hello urlrouter');\n  });\n  app.get('/user/:id([0-9]+)', function (req, res, next) {\n    res.end('hello user ' + req.params.id);\n  });\n})).listen(3000);\n```\n\nSeveral callbacks may also be passed.\n\n```js\n\nfunction loadUser(req, res, next) {\n  // You would fetch user from the db\n  var user = users[req.params.id];\n  if (user) {\n    req.user = user;\n    next();\n  } else {\n    next(new Error('Failed to load user ' + req.params.id));\n  }\n}\n\napp.get('/user/:id', loadUser, function () {\n  // ...\n});\n```\n\nThese callbacks can be passed within arrays as well.\n\n```js\nvar middleware = [loadUser, loadForum, loadThread];\napp.post('/forum/:fid/thread/:tid', middleware, function () {\n // ...\n});\n```\n\n### Using with `http.createServer()`\n\n```js\nvar http = require('http');\nvar urlrouter = require('urlrouter');\n\nvar options = {\n  pageNotFound: function (req, res) {\n    res.statusCode = 404;\n    res.end('er... some page miss...');\n  },\n  errorHandler: function (req, res) {\n    res.statusCode = 500;\n    res.end('oops..error occurred');\n  }\n};\n\nfunction loadUser(req, res, next) {\n  // You would fetch user from the db\n  var user = users[req.params.id];\n  if (user) {\n    req.user = user;\n    next();\n  } else {\n    next(new Error('Failed to load user ' + req.params.id));\n  }\n}\n\nvar routerMiddleware = urlrouter(function (app) {\n  app.get('/', function (req, res) {\n    res.end('GET home page' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n  // with route middleware\n  app.get('/user/:id', loadUser, function (req, res) {\n    res.end('user: ' + req.params.id);\n  });\n\n  // GET /admin 301 redirect to /admin/\n  app.redirect('/admin', '/admin/');\n\n  app.get(/^\\/users?(?:\\/(\\d+)(?:\\.\\.(\\d+))?)?/, loadUser, function (req, res) {\n    res.end(req.url + ' : ' + req.params);\n  });\n\n  app.get('/foo', function (req, res) {\n    res.end('GET ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.post('/new', function (req, res) {\n    res.write('POST ' + req.url + ' start...\\n\\n');\n    var counter = 0;\n    req.on('data', function (data) {\n      counter++;\n      res.write('data' + counter + ': ' + data.toString() + '\\n\\n');\n    });\n    req.on('end', function () {\n      res.end('POST ' + req.url + ' end.\\n');\n    });\n  });\n\n  app.put('/update', function (req, res) {\n    res.end('PUT ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.delete('/remove', function (req, res) {\n    res.end('DELETE ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.options('/check', function (req, res) {\n    res.end('OPTIONS ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.all('/all', function (req, res) {\n    res.end('ALL methods request /all should be handled' + ' , headers: ' + JSON.stringify(req.headers));\n  });\n}, options);\n\nhttp.createServer(routerMiddleware).listen(3000);\n```\n\n## Contributors\n\n```bash\n$ git summary\n\n project  : urlrouter\n repo age : 1 year, 1 month\n active   : 16 days\n commits  : 38\n files    : 19\n authors  :\n    33  fengmk2                 86.8%\n     4  rockdai                 10.5%\n     1  rock                    2.6%\n```\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2012 - 2013 fengmk2 <fengmk2@gmail.com>.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","readmeFilename":"README.md","_id":"urlrouter@0.5.2","dist":{"shasum":"ca4764b050dfa925e06c51c54cb4a540a6b2afc6","tarball":"https://registry.npmjs.org/urlrouter/-/urlrouter-0.5.2.tgz","integrity":"sha512-o+9L82vZV77xT0vuq52tpmZJ0MRFRBFcFvdPzwXZ1W7DgBmC6aXcz2DILJnXYQGWg8gdDjyrvcXYei+Vc9HxVg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCFP2PE/WXhKmXMI6bZY/O8hEW20lC6878Ob8gxdhdfqAIhAMMkD7M6yG6dKEywHe14z4v/1Tbm4yzq6i4FVQTlzUVM"}]},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}]},"0.5.3":{"name":"urlrouter","description":"connect missing router middleware, support express format routing.","keywords":["router","url","connect","middleware","express"],"version":"0.5.3","homepage":"http://github.com/fengmk2/urlrouter","author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"repository":{"url":"git://github.com/fengmk2/urlrouter.git","type":"git"},"bugs":{"url":"http://github.com/fengmk2/urlrouter/issues"},"main":"index.js","scripts":{"test":"make test-all"},"dependencies":{"methods":"0.0.1"},"devDependencies":{"mocha":"*","should":"*","supertest":"*","pedding":"*","blanket":"*","travis-cov":"*","coveralls":"*","mocha-lcov-reporter":"*","connect":">=1.8.0"},"engines":{"node":">=0.6.7"},"contributors":[{"name":"fengmk2","email":"fengmk2@gmail.com","url":"https://github.com/fengmk2"},{"name":"rockdai","email":"rockdai@qq.com","url":"https://github.com/rockdai"}],"readme":"# urlrouter [![Build Status](https://secure.travis-ci.org/fengmk2/urlrouter.png)](http://travis-ci.org/fengmk2/urlrouter) [![Coverage Status](https://coveralls.io/repos/fengmk2/urlrouter/badge.png)](https://coveralls.io/r/fengmk2/urlrouter)\n\n[![NPM](https://nodei.co/npm/urlrouter.png?downloads=true&stars=true)](https://nodei.co/npm/urlrouter/)\n\n![logo](https://raw.github.com/fengmk2/urlrouter/master/logo.png)\n\n`http` url router.\n\n[connect](https://github.com/senchalabs/connect) missing router middleware.\n\nSupport [express](http://expressjs.com) format [routing](http://expressjs.com/guide.html#routing).\n\nSupport `connect` @1.8.x and @2.2.0+ .\n\n## Test connect version\n\n* 1.8.0+: 1.8.0 1.8.5 1.8.6 1.8.7\n* 1.9.0+\n* 2.2.0+\n* 2.3.0+\n* 2.4.0+\n* 2.7.0+\n* 2.8.0+\n\n```bash\n$ make test-all\n```\n\n## Install\n\n```bash\n$ npm install urlrouter\n```\n\n## Usage\n\n### Using with `connect`\n\n```js\nvar connect = require('connect');\nvar urlrouter = require('urlrouter');\n\nconnect(urlrouter(function (app) {\n  app.get('/', function (req, res, next) {\n    res.end('hello urlrouter');\n  });\n  app.get('/user/:id([0-9]+)', function (req, res, next) {\n    res.end('hello user ' + req.params.id);\n  });\n})).listen(3000);\n```\n\nSeveral callbacks may also be passed.\n\n```js\n\nfunction loadUser(req, res, next) {\n  // You would fetch user from the db\n  var user = users[req.params.id];\n  if (user) {\n    req.user = user;\n    next();\n  } else {\n    next(new Error('Failed to load user ' + req.params.id));\n  }\n}\n\napp.get('/user/:id', loadUser, function () {\n  // ...\n});\n```\n\nThese callbacks can be passed within arrays as well.\n\n```js\nvar middleware = [loadUser, loadForum, loadThread];\napp.post('/forum/:fid/thread/:tid', middleware, function () {\n // ...\n});\n```\n\n### Using with `http.createServer()`\n\n```js\nvar http = require('http');\nvar urlrouter = require('urlrouter');\n\nvar options = {\n  pageNotFound: function (req, res) {\n    res.statusCode = 404;\n    res.end('er... some page miss...');\n  },\n  errorHandler: function (req, res) {\n    res.statusCode = 500;\n    res.end('oops..error occurred');\n  }\n};\n\nfunction loadUser(req, res, next) {\n  // You would fetch user from the db\n  var user = users[req.params.id];\n  if (user) {\n    req.user = user;\n    next();\n  } else {\n    next(new Error('Failed to load user ' + req.params.id));\n  }\n}\n\nvar routerMiddleware = urlrouter(function (app) {\n  app.get('/', function (req, res) {\n    res.end('GET home page' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n  // with route middleware\n  app.get('/user/:id', loadUser, function (req, res) {\n    res.end('user: ' + req.params.id);\n  });\n\n  // GET /admin 301 redirect to /admin/\n  app.redirect('/admin', '/admin/');\n\n  app.get(/^\\/users?(?:\\/(\\d+)(?:\\.\\.(\\d+))?)?/, loadUser, function (req, res) {\n    res.end(req.url + ' : ' + req.params);\n  });\n\n  app.get('/foo', function (req, res) {\n    res.end('GET ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.post('/new', function (req, res) {\n    res.write('POST ' + req.url + ' start...\\n\\n');\n    var counter = 0;\n    req.on('data', function (data) {\n      counter++;\n      res.write('data' + counter + ': ' + data.toString() + '\\n\\n');\n    });\n    req.on('end', function () {\n      res.end('POST ' + req.url + ' end.\\n');\n    });\n  });\n\n  app.put('/update', function (req, res) {\n    res.end('PUT ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.delete('/remove', function (req, res) {\n    res.end('DELETE ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.options('/check', function (req, res) {\n    res.end('OPTIONS ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.all('/all', function (req, res) {\n    res.end('ALL methods request /all should be handled' + ' , headers: ' + JSON.stringify(req.headers));\n  });\n}, options);\n\nhttp.createServer(routerMiddleware).listen(3000);\n```\n\n## Contributors\n\n```bash\n$ git summary\n\n project  : urlrouter\n repo age : 1 year, 1 month\n active   : 16 days\n commits  : 38\n files    : 19\n authors  :\n    33  fengmk2                 86.8%\n     4  rockdai                 10.5%\n     1  rock                    2.6%\n```\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2012 - 2013 fengmk2 <fengmk2@gmail.com>.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","readmeFilename":"README.md","_id":"urlrouter@0.5.3","dist":{"shasum":"ada3c71e195c3be296addbb49334c54f4cdf7e31","tarball":"https://registry.npmjs.org/urlrouter/-/urlrouter-0.5.3.tgz","integrity":"sha512-EQt+2ArfEQvDJAxYSMOxGipkswQRn3O4/5SfHzKrsV9SJHlh8lJZmesZdUBCnFgObYyUpxbUNS/w09A8QX8Haw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCJASIvIHPg2oc3I1oicH9TILMui6gMrmsEgZCxkCdcagIgJQUPvRR3Q8b4ctikU5lNSICprijS4HAOT+C7te5Y/70="}]},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}]},"0.5.4":{"name":"urlrouter","description":"connect missing router middleware, support express format routing.","keywords":["router","url","connect","middleware","express"],"version":"0.5.4","homepage":"http://github.com/fengmk2/urlrouter","author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"repository":{"url":"git://github.com/fengmk2/urlrouter.git","type":"git"},"bugs":{"url":"http://github.com/fengmk2/urlrouter/issues"},"main":"index.js","scripts":{"test":"make test-all"},"dependencies":{"methods":"0.1.0"},"devDependencies":{"mocha":"*","should":"*","supertest":"*","pedding":"*","blanket":"*","travis-cov":"*","coveralls":"*","mocha-lcov-reporter":"*","connect":">=1.8.0"},"engines":{"node":">=0.6.7"},"contributors":[{"name":"fengmk2","email":"fengmk2@gmail.com","url":"https://github.com/fengmk2"},{"name":"rockdai","email":"rockdai@qq.com","url":"https://github.com/rockdai"}],"readme":"# urlrouter [![Build Status](https://secure.travis-ci.org/fengmk2/urlrouter.png)](http://travis-ci.org/fengmk2/urlrouter) [![Coverage Status](https://coveralls.io/repos/fengmk2/urlrouter/badge.png)](https://coveralls.io/r/fengmk2/urlrouter) [![Dependency Status](https://gemnasium.com/fengmk2/urlrouter.png)](https://gemnasium.com/fengmk2/urlrouter)\n\n[![NPM](https://nodei.co/npm/urlrouter.png?downloads=true&stars=true)](https://nodei.co/npm/urlrouter/)\n\n![logo](https://raw.github.com/fengmk2/urlrouter/master/logo.png)\n\n`http` url router.\n\n[connect](https://github.com/senchalabs/connect) missing router middleware.\n\nSupport [express](http://expressjs.com) format [routing](http://expressjs.com/guide.html#routing).\n\nSupport `connect` @1.8.x and @2.2.0+ .\n\n## Test connect version\n\n* 1.8.0+: 1.8.0 1.8.5 1.8.6 1.8.7\n* 1.9.0+\n* 2.2.0+\n* 2.3.0+\n* 2.4.0+\n* 2.7.0+\n* 2.8.0+\n\n```bash\n$ make test-all\n```\n\n## Install\n\n```bash\n$ npm install urlrouter\n```\n\n## Usage\n\n### Using with `connect`\n\n```js\nvar connect = require('connect');\nvar urlrouter = require('urlrouter');\n\nconnect(urlrouter(function (app) {\n  app.get('/', function (req, res, next) {\n    res.end('hello urlrouter');\n  });\n  app.get('/user/:id([0-9]+)', function (req, res, next) {\n    res.end('hello user ' + req.params.id);\n  });\n})).listen(3000);\n```\n\nSeveral callbacks may also be passed.\n\n```js\n\nfunction loadUser(req, res, next) {\n  // You would fetch user from the db\n  var user = users[req.params.id];\n  if (user) {\n    req.user = user;\n    next();\n  } else {\n    next(new Error('Failed to load user ' + req.params.id));\n  }\n}\n\napp.get('/user/:id', loadUser, function () {\n  // ...\n});\n```\n\nThese callbacks can be passed within arrays as well.\n\n```js\nvar middleware = [loadUser, loadForum, loadThread];\napp.post('/forum/:fid/thread/:tid', middleware, function () {\n // ...\n});\n```\n\n### Using with `http.createServer()`\n\n```js\nvar http = require('http');\nvar urlrouter = require('urlrouter');\n\nvar options = {\n  pageNotFound: function (req, res) {\n    res.statusCode = 404;\n    res.end('er... some page miss...');\n  },\n  errorHandler: function (req, res) {\n    res.statusCode = 500;\n    res.end('oops..error occurred');\n  }\n};\n\nfunction loadUser(req, res, next) {\n  // You would fetch user from the db\n  var user = users[req.params.id];\n  if (user) {\n    req.user = user;\n    next();\n  } else {\n    next(new Error('Failed to load user ' + req.params.id));\n  }\n}\n\nvar routerMiddleware = urlrouter(function (app) {\n  app.get('/', function (req, res) {\n    res.end('GET home page' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n  // with route middleware\n  app.get('/user/:id', loadUser, function (req, res) {\n    res.end('user: ' + req.params.id);\n  });\n\n  // GET /admin 301 redirect to /admin/\n  app.redirect('/admin', '/admin/');\n\n  app.get(/^\\/users?(?:\\/(\\d+)(?:\\.\\.(\\d+))?)?/, loadUser, function (req, res) {\n    res.end(req.url + ' : ' + req.params);\n  });\n\n  app.get('/foo', function (req, res) {\n    res.end('GET ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.post('/new', function (req, res) {\n    res.write('POST ' + req.url + ' start...\\n\\n');\n    var counter = 0;\n    req.on('data', function (data) {\n      counter++;\n      res.write('data' + counter + ': ' + data.toString() + '\\n\\n');\n    });\n    req.on('end', function () {\n      res.end('POST ' + req.url + ' end.\\n');\n    });\n  });\n\n  app.put('/update', function (req, res) {\n    res.end('PUT ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.delete('/remove', function (req, res) {\n    res.end('DELETE ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.options('/check', function (req, res) {\n    res.end('OPTIONS ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.all('/all', function (req, res) {\n    res.end('ALL methods request /all should be handled' + ' , headers: ' + JSON.stringify(req.headers));\n  });\n}, options);\n\nhttp.createServer(routerMiddleware).listen(3000);\n```\n\n## Contributors\n\n```bash\n$ git summary\n\n project  : urlrouter\n repo age : 1 year, 1 month\n active   : 16 days\n commits  : 38\n files    : 19\n authors  :\n    33  fengmk2                 86.8%\n     4  rockdai                 10.5%\n     1  rock                    2.6%\n```\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2012 - 2013 fengmk2 <fengmk2@gmail.com>.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","readmeFilename":"README.md","_id":"urlrouter@0.5.4","dist":{"shasum":"bab69f09559921b2b5714c2b837140550fe99859","tarball":"https://registry.npmjs.org/urlrouter/-/urlrouter-0.5.4.tgz","integrity":"sha512-yep6m8nBGBIwyHIb79MSg/265h4fKsVM4ULuq2q1cIyxSzjm3CB+NLQf5NAfEXBa8p2kU6Zn+Wi9LKm7DDWJiA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHMogU/RQaAILr68U+zDcGDnKUbsIycNLJtxq4jMMSihAiEA3vToYdWKWsOoNLvgjn0UnywN9sb+/ogFzfqXPO9Wq/A="}]},"_from":".","_npmVersion":"1.3.17","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}]}},"readme":"# urlrouter\n\n[![Build Status](https://secure.travis-ci.org/fengmk2/urlrouter.png)](http://travis-ci.org/fengmk2/urlrouter)\n\n`http` url router.\n\n[connect](https://github.com/senchalabs/connect) missing router middleware.\n\nSupport `connect` @1.8.x and @2.2.0+ .\n\n## Test connect version\n\n* 1.8.x: 1.8.0 1.8.5 1.8.6 1.8.7\n* 2.2.x: 2.2.0 2.2.1 2.2.2 \n* 2.3.x: 2.3.0 2.3.1 2.3.2 2.3.3\n\n```bash\n$ make test-version\n```\n\n## Install\n\n```bash\n$ npm install urlrouter\n```\n\n## Usage\n\n### Using with `connect`\n\n```javascript\nvar connect = require('connect');\nvar urlrouter = require('urlrouter');\n\nconnect(urlrouter(function (app) {\n  app.get('/', function (req, res, next) {\n    res.end('hello urlrouter');\n  });\n})).listen(3000);\n```\n\n### Using with `http.createServer()`\n\n```javascript\nvar http = require('http');\nvar urlrouter = require('urlrouter');\n\nvar router = urlrouter(function (app) {\n  app.get('/', function (req, res) {\n    res.end('GET home page' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.get('/foo', function (req, res) {\n    res.end('GET ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.post('/new', function (req, res) {\n    res.write('POST ' + req.url + ' start...\\n\\n');\n    var counter = 0;\n    req.on('data', function (data) {\n      counter++;\n      res.write('data' + counter + ': ' + data.toString() + '\\n\\n');\n    });\n    req.on('end', function () {\n      res.end('POST ' + req.url + ' end.\\n');\n    });\n  });\n\n  app.put('/update', function (req, res) {\n    res.end('PUT ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.delete('/remove', function (req, res) {\n    res.end('DELETE ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n\n  app.options('/check', function (req, res) {\n    res.end('PUT ' + req.url + ' , headers: ' + JSON.stringify(req.headers));\n  });\n});\n\nhttp.createServer(router).listen(3000);\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 fengmk2 <fengmk2@gmail.com>.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"time":{"modified":"2022-06-28T06:30:31.574Z","created":"2012-06-19T16:45:53.062Z","0.1.0":"2012-06-19T16:46:04.493Z","0.2.0":"2012-06-20T12:13:13.723Z","0.2.1":"2012-08-13T17:10:36.654Z","0.2.3":"2012-09-26T03:15:50.286Z","0.3.0":"2013-04-07T08:52:50.603Z","0.4.0":"2013-06-18T09:44:32.113Z","0.5.0":"2013-07-18T05:35:46.196Z","0.5.1":"2013-07-18T05:51:33.779Z","0.5.2":"2013-11-23T06:11:51.157Z","0.5.3":"2013-11-23T06:24:13.718Z","0.5.4":"2013-12-16T15:53:36.702Z"},"author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"repository":{"url":"git://github.com/fengmk2/urlrouter.git","type":"git"}}