{"_id":"trouter","_rev":"4003622","name":"trouter","description":"🐟 A fast, small-but-mighty, familiar ~fish~ router","dist-tags":{"latest":"4.0.0"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"time":{"modified":"2025-09-01T02:21:30.000Z","created":"2017-11-05T19:35:27.873Z","4.0.0":"2023-12-04T15:20:52.373Z","3.2.1":"2023-02-22T02:10:53.266Z","3.2.0":"2021-03-27T16:08:27.991Z","3.1.0":"2019-07-11T04:55:22.831Z","3.0.2":"2019-05-02T18:14:25.959Z","3.0.1":"2019-04-22T20:54:17.027Z","3.0.0":"2019-03-10T00:36:27.838Z","2.0.1":"2018-09-18T01:29:19.017Z","1.1.0":"2018-05-02T21:59:23.398Z","1.0.0":"2018-01-11T10:10:29.597Z","0.1.1":"2017-12-23T04:21:20.928Z","0.1.0":"2017-12-22T20:18:42.338Z","0.0.0":"2017-11-05T19:35:27.873Z"},"users":{},"author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"repository":{"type":"git","url":"git+https://github.com/lukeed/trouter.git"},"versions":{"4.0.0":{"name":"trouter","version":"4.0.0","repository":{"type":"git","url":"git+https://github.com/lukeed/trouter.git"},"description":"🐟 A fast, small-but-mighty, familiar ~fish~ router","types":"index.d.ts","module":"index.mjs","main":"index.js","license":"MIT","exports":{".":{"types":"./index.d.ts","import":"./index.mjs","require":"./index.js"},"./package.json":"./package.json"},"author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">=6"},"scripts":{"bench":"node bench","prepack":"bundt index.mjs","test":"uvu -r esm test"},"keywords":["route","router","routing"],"dependencies":{"regexparam":"^3.0.0"},"devDependencies":{"bundt":"1.1.2","esm":"3.2.25","uvu":"0.5.1"},"_id":"trouter@4.0.0","gitHead":"c5176edd1cd94b439a341c6b009f2f7b3d42d5a6","bugs":{"url":"https://github.com/lukeed/trouter/issues"},"homepage":"https://github.com/lukeed/trouter#readme","_nodeVersion":"20.8.1","_npmVersion":"10.1.0","dist":{"shasum":"88aefbfef88ef83b2d72b5c3e8a64532ae70b3e8","size":4794,"noattachment":false,"key":"/trouter/-/trouter-4.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/trouter/download/trouter-4.0.0.tgz"},"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/trouter_4.0.0_1701703252038_0.13675259186998856"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-12-04T15:20:52.373Z","publish_time":1701703252373,"_source_registry_name":"default","_cnpm_publish_time":1701703252373},"3.2.1":{"name":"trouter","version":"3.2.1","repository":{"type":"git","url":"git+https://github.com/lukeed/trouter.git"},"description":"🐟 A fast, small-but-mighty, familiar ~fish~ router","types":"index.d.ts","module":"index.mjs","main":"index.js","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">=6"},"scripts":{"bench":"node bench","prepack":"bundt index.mjs","test":"tape -r esm test/*.js | tap-spec"},"keywords":["route","router","routing"],"dependencies":{"regexparam":"^1.3.0"},"devDependencies":{"bundt":"1.1.2","esm":"3.2.22","tap-spec":"5.0.0","tape":"4.11.0"},"gitHead":"c80136f022c1960ddf2ac445e6ae7603156b054f","bugs":{"url":"https://github.com/lukeed/trouter/issues"},"homepage":"https://github.com/lukeed/trouter#readme","_id":"trouter@3.2.1","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"shasum":"a07e6f39a48fa0950a0157897075b633265b0fd9","size":4746,"noattachment":false,"key":"/trouter/-/trouter-3.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/trouter/download/trouter-3.2.1.tgz"},"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/trouter_3.2.1_1677031853136_0.5222145260178734"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-02-22T02:10:53.266Z","publish_time":1677031853266,"_cnpm_publish_time":1677031853266},"3.2.0":{"name":"trouter","version":"3.2.0","repository":{"type":"git","url":"git+https://github.com/lukeed/trouter.git"},"description":"🐟 A fast, small-but-mighty, familiar ~fish~ router","types":"index.d.ts","module":"index.mjs","main":"index.js","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">=6"},"scripts":{"bench":"node bench","prepack":"bundt index.mjs","test":"tape -r esm test/*.js | tap-spec"},"keywords":["route","router","routing"],"dependencies":{"regexparam":"^1.3.0"},"devDependencies":{"bundt":"1.1.2","esm":"3.2.22","tap-spec":"5.0.0","tape":"4.11.0"},"gitHead":"0692417c728a4f6aecbc350f714019baf3072bc7","bugs":{"url":"https://github.com/lukeed/trouter/issues"},"homepage":"https://github.com/lukeed/trouter#readme","_id":"trouter@3.2.0","_nodeVersion":"14.15.3","_npmVersion":"6.14.9","dist":{"shasum":"a9c510fce21b8e659a28732c9de9d82871efe8df","size":4679,"noattachment":false,"key":"/trouter/-/trouter-3.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/trouter/download/trouter-3.2.0.tgz"},"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/trouter_3.2.0_1616861307654_0.3454136426669543"},"_hasShrinkwrap":false,"publish_time":1616861307991,"_cnpm_publish_time":1616861307991},"3.1.0":{"name":"trouter","version":"3.1.0","repository":{"type":"git","url":"git+https://github.com/lukeed/trouter.git"},"description":"🐟 A fast, small-but-mighty, familiar ~fish~ router","module":"index.mjs","main":"index.js","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"lukeed.com"},"engines":{"node":">=6"},"scripts":{"bench":"node bench","prepack":"bundt index.mjs","test":"tape -r esm test/*.js | tap-spec"},"keywords":["route","router","routing"],"dependencies":{"regexparam":"^1.3.0"},"devDependencies":{"bundt":"0.4.0","esm":"3.2.22","tap-spec":"5.0.0","tape":"4.11.0"},"gitHead":"ca4c61d11f538218680b11982211af427f794d32","bugs":{"url":"https://github.com/lukeed/trouter/issues"},"homepage":"https://github.com/lukeed/trouter#readme","_id":"trouter@3.1.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.3","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"shasum":"76f4faea81d5ebd11bba4762c664a3b55eda9b23","size":4229,"noattachment":false,"key":"/trouter/-/trouter-3.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/trouter/download/trouter-3.1.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/trouter_3.1.0_1562820922700_0.5727389805149532"},"_hasShrinkwrap":false,"publish_time":1562820922831,"_cnpm_publish_time":1562820922831},"3.0.2":{"name":"trouter","version":"3.0.2","repository":{"type":"git","url":"git+https://github.com/lukeed/trouter.git"},"description":"🐟 A fast, small-but-mighty, familiar ~fish~ router","module":"index.mjs","main":"index.js","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"lukeed.com"},"engines":{"node":">=6"},"scripts":{"bench":"node bench","prepack":"bundt index.mjs","test":"tape -r esm test/*.js | tap-spec"},"keywords":["route","router","routing"],"dependencies":{"regexparam":"^1.2.0"},"devDependencies":{"bundt":"0.4.0","esm":"3.2.22","tap-spec":"^5.0.0","tape":"4.10.1"},"gitHead":"0bbc63f98951c7bb2e87a07aaa2a93c039a8379b","bugs":{"url":"https://github.com/lukeed/trouter/issues"},"homepage":"https://github.com/lukeed/trouter#readme","_id":"trouter@3.0.2","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"shasum":"9dbc114ee05659705438430c5c8a19f46da07dad","size":4125,"noattachment":false,"key":"/trouter/-/trouter-3.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/trouter/download/trouter-3.0.2.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/trouter_3.0.2_1556820865754_0.06652581174543037"},"_hasShrinkwrap":false,"publish_time":1556820865959,"_cnpm_publish_time":1556820865959},"3.0.1":{"name":"trouter","version":"3.0.1","repository":{"type":"git","url":"git+https://github.com/lukeed/trouter.git"},"description":"🐟 A fast, small-but-mighty, familiar ~fish~ router","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"lukeed.com"},"engines":{"node":">=6"},"scripts":{"bench":"node bench","test":"tape test/*.js | tap-spec"},"keywords":["route","router","routing"],"dependencies":{"regexparam":"^1.2.0"},"devDependencies":{"tap-spec":"^4.1.1","tape":"^4.6.3"},"gitHead":"b068dd7edc5444b7c1953da1d3a2933d1df50c69","bugs":{"url":"https://github.com/lukeed/trouter/issues"},"homepage":"https://github.com/lukeed/trouter#readme","_id":"trouter@3.0.1","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"shasum":"620271d2963a87b463a09d21f25475da063dde21","size":4005,"noattachment":false,"key":"/trouter/-/trouter-3.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/trouter/download/trouter-3.0.1.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/trouter_3.0.1_1555966456804_0.8756178080838104"},"_hasShrinkwrap":false,"publish_time":1555966457027,"_cnpm_publish_time":1555966457027},"3.0.0":{"name":"trouter","version":"3.0.0","repository":{"type":"git","url":"git+https://github.com/lukeed/trouter.git"},"description":"🐟 A fast, small-but-mighty, familiar ~fish~ router","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"lukeed.com"},"engines":{"node":">=6"},"scripts":{"bench":"node bench","test":"tape test/*.js | tap-spec"},"keywords":["route","router","routing"],"dependencies":{"regexparam":"^1.2.0"},"devDependencies":{"tap-spec":"^4.1.1","tape":"^4.6.3"},"gitHead":"ed2d768f27b5369cfeeb014a8a2cf2cdf93851d2","bugs":{"url":"https://github.com/lukeed/trouter/issues"},"homepage":"https://github.com/lukeed/trouter#readme","_id":"trouter@3.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"shasum":"361b9f363149504906cb9ec0cf79128acbe8033e","size":3981,"noattachment":false,"key":"/trouter/-/trouter-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/trouter/download/trouter-3.0.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/trouter_3.0.0_1552178187577_0.045950177505214906"},"_hasShrinkwrap":false,"publish_time":1552178187838,"_cnpm_publish_time":1552178187838},"2.0.1":{"name":"trouter","version":"2.0.1","description":"🐟 A fast, small-but-mighty, familiar ~fish~ router","repository":{"type":"git","url":"git+https://github.com/lukeed/trouter.git"},"license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"lukeed.com"},"engines":{"node":">=6"},"scripts":{"bench":"node bench","test":"tape test/*.js | tap-spec"},"keywords":["route","router","routing"],"dependencies":{"matchit":"^1.0.0"},"devDependencies":{"tap-spec":"^4.1.1","tape":"^4.6.3"},"gitHead":"6b098ad31f36f586d6adafc134ed16c93af7d0b4","bugs":{"url":"https://github.com/lukeed/trouter/issues"},"homepage":"https://github.com/lukeed/trouter#readme","_id":"trouter@2.0.1","_npmVersion":"6.2.0","_nodeVersion":"10.9.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"shasum":"2726a5f8558e090d24c3a393f09eaab1df232df6","size":3486,"noattachment":false,"key":"/trouter/-/trouter-2.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/trouter/download/trouter-2.0.1.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/trouter_2.0.1_1537234158854_0.7078570271101696"},"_hasShrinkwrap":false,"publish_time":1537234159017,"_cnpm_publish_time":1537234159017},"1.1.0":{"name":"trouter","version":"1.1.0","description":"🐟 A fast, small-but-mighty, familiar ~fish~ router","repository":{"type":"git","url":"git+https://github.com/lukeed/trouter.git"},"main":"lib/index.js","license":"MIT","files":["lib"],"author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"lukeed.com"},"engines":{"node":">=6"},"scripts":{"bench":"node bench","test":"tape test/*.js | tap-spec"},"keywords":["route","router","routing"],"dependencies":{"matchit":"^1.0.0"},"devDependencies":{"tap-spec":"^4.1.1","tape":"^4.6.3"},"gitHead":"080d5a174dbe88eb739693c00dfb74cb70ffcfd1","bugs":{"url":"https://github.com/lukeed/trouter/issues"},"homepage":"https://github.com/lukeed/trouter#readme","_id":"trouter@1.1.0","_npmVersion":"5.5.1","_nodeVersion":"8.9.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"shasum":"ce0ad2aaa4f13af21e34785079c3352298b9259a","size":3140,"noattachment":false,"key":"/trouter/-/trouter-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/trouter/download/trouter-1.1.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/trouter_1.1.0_1525298363296_0.6287556199339028"},"_hasShrinkwrap":false,"publish_time":1525298363398,"_cnpm_publish_time":1525298363398},"1.0.0":{"name":"trouter","version":"1.0.0","description":"🐟 A fast, small-but-mighty, familiar ~fish~ router","repository":{"type":"git","url":"git+https://github.com/lukeed/trouter.git"},"main":"lib/index.js","license":"MIT","files":["lib"],"author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"lukeed.com"},"engines":{"node":">=6"},"scripts":{"bench":"node bench","test":"tape test/*.js | tap-spec"},"keywords":["route","router","routing"],"dependencies":{"matchit":"^1.0.0"},"devDependencies":{"tap-spec":"^4.1.1","tape":"^4.6.3"},"gitHead":"28cb8b15bda8954b0a0ab01b424ae0f366a05896","bugs":{"url":"https://github.com/lukeed/trouter/issues"},"homepage":"https://github.com/lukeed/trouter#readme","_id":"trouter@1.0.0","_shasum":"4f845e0cdf4749276565d60f6dc9d61f55d6c0bb","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.1","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"shasum":"4f845e0cdf4749276565d60f6dc9d61f55d6c0bb","size":2883,"noattachment":false,"key":"/trouter/-/trouter-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/trouter/download/trouter-1.0.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/trouter-1.0.0.tgz_1515665429459_0.13703137589618564"},"directories":{},"publish_time":1515665429597,"_hasShrinkwrap":false,"_cnpm_publish_time":1515665429597},"0.1.1":{"name":"trouter","version":"0.1.1","description":"WIP","repository":{"type":"git","url":"git+https://github.com/lukeed/mri.git"},"main":"lib/index.js","license":"MIT","files":["lib"],"author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"lukeed.com"},"engines":{"node":">=6"},"scripts":{"bench":"node bench","test":"tape test/*.js | tap-spec"},"keywords":[],"dependencies":{"matchit":"^1.0.0"},"devDependencies":{"tap-spec":"^4.1.1","tape":"^4.6.3"},"gitHead":"428ca8110ed53e519a779773244928da127ec42d","bugs":{"url":"https://github.com/lukeed/mri/issues"},"homepage":"https://github.com/lukeed/mri#readme","_id":"trouter@0.1.1","_shasum":"7f066cf5669812b2af391170ad2189a57924369c","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.1","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"shasum":"7f066cf5669812b2af391170ad2189a57924369c","size":1696,"noattachment":false,"key":"/trouter/-/trouter-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/trouter/download/trouter-0.1.1.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/trouter-0.1.1.tgz_1514002880849_0.6184568139724433"},"directories":{},"publish_time":1514002880928,"_hasShrinkwrap":false,"_cnpm_publish_time":1514002880928},"0.1.0":{"name":"trouter","version":"0.1.0","description":"WIP","repository":{"type":"git","url":"git+https://github.com/lukeed/mri.git"},"main":"lib/index.js","license":"MIT","files":["lib"],"author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"lukeed.com"},"engines":{"node":">=6"},"scripts":{"bench":"node bench","test":"tape test/*.js | tap-spec"},"keywords":[],"dependencies":{"matchit":"^1.0.0"},"devDependencies":{"tap-spec":"^4.1.1","tape":"^4.6.3"},"gitHead":"4ed8df9e5946ebda0a41543d57fe2f59c7ca54da","bugs":{"url":"https://github.com/lukeed/mri/issues"},"homepage":"https://github.com/lukeed/mri#readme","_id":"trouter@0.1.0","_shasum":"a806dbaf759568c9a125e03421ae01ad2e67fd0c","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.1","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"shasum":"a806dbaf759568c9a125e03421ae01ad2e67fd0c","size":1686,"noattachment":false,"key":"/trouter/-/trouter-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/trouter/download/trouter-0.1.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/trouter-0.1.0.tgz_1513973922271_0.6124841803684831"},"directories":{},"publish_time":1513973922338,"_hasShrinkwrap":false,"_cnpm_publish_time":1513973922338},"0.0.0":{"name":"trouter","version":"0.0.0","description":"WIP","repository":{"type":"git","url":"git+https://github.com/lukeed/mri.git"},"main":"lib/index.js","license":"MIT","files":["lib"],"author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"lukeed.com"},"engines":{"node":">=6"},"scripts":{"bench":"node bench","test":"tape test/*.js | tap-spec"},"keywords":[],"devDependencies":{"tap-spec":"^4.1.1","tape":"^4.6.3"},"gitHead":"0afc0faf4af8096c8dab4899a9d513429d748c9a","bugs":{"url":"https://github.com/lukeed/mri/issues"},"homepage":"https://github.com/lukeed/mri#readme","_id":"trouter@0.0.0","_shasum":"2e5984587c15dd9288d847048ec571ae5461df26","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.1","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"shasum":"2e5984587c15dd9288d847048ec571ae5461df26","size":1325,"noattachment":false,"key":"/trouter/-/trouter-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/trouter/download/trouter-0.0.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/trouter-0.0.0.tgz_1509910527783_0.37793847103603184"},"directories":{},"publish_time":1509910527873,"_hasShrinkwrap":false,"_cnpm_publish_time":1509910527873}},"readme":"# trouter [![CI](https://github.com/lukeed/trouter/actions/workflows/ci.yml/badge.svg)](https://github.com/lukeed/trouter/actions/workflows/ci.yml)\n\n> ???? A fast, small-but-mighty, familiar ~fish~ router\n\n\n## Install\n\n```\n$ npm install --save trouter\n```\n\n\n## Usage\n\n```js\nimport { Trouter } from 'trouter';\n\nconst router = new Trouter();\n\n// Define all routes\nrouter\n  .get('/users', _ => {\n    console.log('> Getting all users');\n  })\n  .add('POST', '/users', _ => {\n    console.log('~> Adding a user');\n  })\n  .get('/users/:id', val => {\n    console.log('~> Getting user with ID:', val);\n  });\n\n// Find a route definition\nlet obj = router.find('GET', '/users/123');\n//=> obj.params ~> { id:123 }\n//=> obj.handlers ~> Array<Function>\n\n// Execute the handlers, passing value\nobj.handlers.forEach(fn => {\n  fn(obj.params.id);\n});\n//=> ~> Getting user with ID: 123\n\n// Returns empty keys when no match\nrouter.find('DELETE', '/foo');\n//=> { params:{}, handlers:[] }\n```\n\n## API\n\n### Trouter()\nInitializes a new `Trouter` instance.\n\n\n### trouter.add(method, pattern, ...handlers)\nReturns: `self`\n\nStores a `method` + `pattern` pairing internally, along with its handler(s).\n\n#### method\nType: `String`\n\nAny uppercased, [valid HTTP/1.1 verb](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods#Specifications) &mdash; choose from one of the following:\n\n```\nGET  HEAD  PATCH  OPTIONS  CONNECT  DELETE  TRACE  POST  PUT\n```\n\n#### pattern\nType: `String` or `RegExp`\n\nTrouter supports simple route patterns which are fast and well readable but limited. If you need more complex patterns, you can pass an instance of `RegExp` with parameters specified as named capture groups.\n\n> **Important:** RegExp named capture groups are [supported in Node.js 10.x](https://node.green/#ES2018-features--RegExp-named-capture-groups) and above!\n\nThe supported route pattern types are:\n\n* static (`/users`)\n* named parameters (`/users/:id`)\n* nested parameters (`/users/:id/books/:title`)\n* optional parameters (`/users/:id?/books/:title?`)\n* suffixed parameters (`/movies/:title.mp4`, `movies/:title.(mp4|mov)`)\n* any match / wildcards (`/users/*`)\n* optional wildcards (`/users/*?`)\n\n#### ...handlers\nType: `Function`\n\nThe function(s) that should be tied to this `pattern`.\n\nBecause this is a [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters), whatever you pass will _always_ be cast to an Array.\n\n> **Important:** Trouter does not care what your function signature looks like!<br> You are not bound to the `(req, res)` standard, or even passing a `Function` at all!\n\n\n### trouter.use(pattern, ...handlers)\nReturns: `self`\n\nThis is an alias for [`trouter.add('', pattern, ...handlers)`](#trouteraddmethod-pattern-handlers), matching **all** HTTP methods.\n\nHowever, unlike [`trouter.all`](#trouterallpattern-handlers), the `pattern` you defined **IS NOT RESTRICTIVE**, which means that the route will match any & all URLs that start (but not end) with a matching segment.\n\n```js\nrouter.use('/foo', 'USE /foo');\nrouter.use('/foo/:name', 'USE /foo/:name');\nrouter.post('/foo/:name', 'POST /foo/:name');\nrouter.head('/foo/:name/hello', 'HEAD /foo/:name/hello');\n\nrouter.find('GET', '/foo').handlers;\n//=> ['USE /foo']\n\nrouter.find('POST', '/foo/bar').handlers;\n//=> ['USE /foo', 'USE /foo/:name', 'POST /foo/:name']\n\nrouter.find('HEAD', '/foo/bar/hello').handlers;\n//=> ['USE /foo', 'USE /foo/:name', 'HEAD /foo/:name/hello']\n```\n<sup>_Compare this snippet with the one below to see differences between `trouter.all` and this method._</sup>\n\n\n### trouter.all(pattern, ...handlers)\nReturns: `self`\n\nThis is an alias for [`trouter.add('', pattern, ...handlers)`](#trouteraddmethod-pattern-handlers), matching **all** HTTP methods.\n\nHowever, unlike [`trouter.use`](#trouterusepattern-handlers), the `pattern` you defined **IS RESTRICTIVE** and behaves like any other [`trouter.METHOD`](#trouteraddmethod-pattern-handlers) route. This means that the URL must match the defined `pattern` exactly – or have the appropriate optional and/or wildcard segments to accommodate the desired flexibility.\n\n```js\nrouter.all('/foo', 'ALL /foo');\nrouter.all('/foo/:name', 'ALL /foo/:name');\nrouter.post('/foo/:name', 'POST /foo/:name');\nrouter.head('/foo/:name/hello', 'HEAD /foo/:name/hello');\n\nrouter.find('GET', '/foo').handlers;\n//=> ['ALL /foo']\n\nrouter.find('POST', '/foo/bar').handlers;\n//=> ['ALL /foo/:name', 'POST /foo/:name']\n\nrouter.find('HEAD', '/foo/bar/hello').handlers;\n//=> ['HEAD /foo/:name/hello']\n```\n<sup>_Compare this snippet with the one above to see differences between `trouter.use` and this method._</sup>\n\n\n\n### trouter.METHOD(pattern, ...handlers)\n\nThis is an alias for [`trouter.add(METHOD, pattern, ...handlers)`](#trouteraddmethod-pattern-handlers), where `METHOD` is any lowercased HTTP verb.\n\n```js\nconst noop = _ => {}:\nconst app = new Trouter();\n\napp.get('/users/:id', noop);\napp.post('/users', noop);\napp.patch('/users/:id', noop);\n\n// less common methods too\napp.trace('/foo', noop);\napp.connect('/bar', noop);\n```\n\n### trouter.find(method, url)\nReturns: `Object`\n\nSearches within current instance for **all** `method` + `pattern` pairs that satisfy the current `method` + `url`.\n\n> **Important:** Parameters and handlers are assembled/gathered _in the order that they were defined!_\n\nThis method will always return an Object with `params` and `handlers` keys.\n\n* `params` &mdash; Object whose keys are the named parameters of your route pattern.\n* `handlers` &mdash; Array containing the `...handlers` provided to [`.add()`](#trouteraddmethod-pattern-handlers) or [`.METHOD()`](#troutermethodpattern-handlers)\n\n> **Note:** The `handlers` and `params` keys will be empty if no matches were found.\n\n\n#### method\nType: `String`\n\nAny valid HTTP method name, uppercased.\n\n> **Note:** When searching for `HEAD` routes, `GET` routes will also be inspected.\n\n#### url\nType: `String`\n\nThe URL used to match against pattern definitions. This is typically `req.url`.\n\n\n## Benchmarks\n\n> Run on Node v10.13.0\n\n```\nGET /                           x 10,349,863 ops/sec ±2.15% (93 runs sampled)\nPOST /users                     x 13,895,099 ops/sec ±0.40% (94 runs sampled)\nGET /users/:id                  x  6,288,457 ops/sec ±0.25% (93 runs sampled)\nPUT /users/:id/books/:title?    x  6,176,501 ops/sec ±0.22% (96 runs sampled)\nDELETE /users/:id/books/:title  x  5,581,288 ops/sec ±2.04% (96 runs sampled)\nHEAD /hello (all)               x  9,700,097 ops/sec ±0.47% (90 runs sampled)\n```\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n","_attachments":{},"homepage":"https://github.com/lukeed/trouter#readme","bugs":{"url":"https://github.com/lukeed/trouter/issues"},"license":"MIT"}