{"_id":"tiny-request-router","_rev":"3-11ffe934ca30b653b64e16027a927eb3","name":"tiny-request-router","dist-tags":{"latest":"1.2.2"},"versions":{"1.1.1":{"name":"tiny-request-router","version":"1.1.1","description":"Fast, generic and type safe router (match method and path).","author":{"name":"berstend"},"license":"MIT","repository":{"type":"git","url":"https://github.com/berstend/tiny-request-router.git"},"homepage":"https://github.com/berstend/tiny-request-router#readme","main":"./dist/router.js","module":"./dist/router.mjs","unpkg":"./dist/router.min.js","browser":{"./dist/router.js":"./dist/router.browser.js","./dist/router.mjs":"./dist/router.browser.mjs"},"types":"dist/src/router.d.ts","scripts":{"check":"tsc --pretty --noEmit","check:watch":"npm run check -- --watch","declarations":"tsc --emitDeclarationOnly","prebuild":"rimraf dist","build":"rollup -c rollup.config.ts && npm run declarations","dev":"npm run prebuild && rollup -c rollup.config.ts -w && npm run declarations","test":"ava-ts -v","prepublish":"npm run build"},"prettier":{"printWidth":100,"semi":false,"singleQuote":true},"keywords":["router","service worker","universal","routing","cloudflare","worker","browser","node","url router","cloudflare worker","typescript","match request"],"devDependencies":{"@types/node":"^12.11.7","@types/node-fetch":"^2.5.2","@types/service-worker-mock":"^2.0.1","ava":"^2.4.0","ava-ts":"^0.25.1","fetch-mock":"7.5.1","isomorphic-fetch":"^2.2.1","node-fetch":"^2.6.0","rimraf":"^3.0.0","rollup":"^1.25.2","rollup-plugin-commonjs":"^10.1.0","rollup-plugin-node-resolve":"^5.2.0","rollup-plugin-terser":"^5.1.2","rollup-plugin-typescript":"^1.0.1","service-worker-mock":"^2.0.3","ts-node":"^8.4.1","tslint":"^5.11.0","tslint-config-prettier":"^1.15.0","tslint-config-standard":"^8.0.1","typescript":"^3.0.3"},"dependencies":{"path-to-regexp":"^3.1.0"},"resolutions":{"**/fsevents":"^1.2.9","fetch-mock":"^7.5.1"},"_id":"tiny-request-router@1.1.1","dist":{"shasum":"111ae67419405d869caa6062c85de426a72315ed","integrity":"sha512-6DQJpCD9YedKiVtU4NgdoAEJFwEj7MDPQeve+zp+JxxpO8zMahbqfMTijCi4uau/AHM/uCBNfKNwON0uAFzA3g==","tarball":"https://registry.npmjs.org/tiny-request-router/-/tiny-request-router-1.1.1.tgz","fileCount":19,"unpackedSize":240790,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdvxMSCRA9TVsSAnZWagAAMBwP/3rIzoiZhnxdXEzFSNjl\nbQPC5Mo2JT2MglJYp0snkKC+MKpswMkeReKKpvur+wEECFhbFC7yqsGbUo8r\nU5B1moCLL/H48pInEJeirMuHnQ11VQnA9TvTXg6xnDOyN2wFdGErdp15JRUW\ngO/CuqvTmKOYPZedwG0v55w3J9GiUQKtmMxsOZz36AleM3DfR6cnIQWIXIRR\nW0Zdir3zzRtcGX8GAhStEnbKn5hMzkKTzZ/dj/ZIPlYVoO2Lytv0Aq4BSdjA\nBK/bLAd0n+c0VC8pfXSYERsqp+sWKeGn+Xlb53z2Zvi93e92lZg9pUfWdzbV\nTwy5qionRg8SIhcfVWSbW6bnHB6fAv1W1W02CRsdapEkTGWGt6zynyXy5IQ4\nMT1Q1KgsNv36wheB5E6E/1HHxNevdAYq+HFBLBaah4/aJ1ZapczvjIDWbzf9\nTHdzSdNDZhJDhmxTKsaJJ6LsyGmHfd5AyRF2qkPdpwC3YTgTKkgQIfMfUc7o\nyIzOnshQSyURpfOQEpN/FUsmY5wvtTKpKDQPOe4S46+LisNGJ1leuStzIbre\nSaMyfkcVx7BwF6fJwOEiVlVXx5BT9angP0dy/ZijyhTdbmgUL8JMR6OBNzQo\nP0UEB6cZ8oEgirfueP9uwi+J9uNEkQ0JB77/m7NXWnlhpCwYxT2IyTEPl6Ck\nSVf1\r\n=TUfZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCVkxkHIsR8I7jp32h+fYSH61pzrBYeCQKZ8jpjIuVPiwIgHFDm4u181m//NepFznCpwoa2Tp803VQZOnx172MKutY="}]},"maintainers":[{"name":"berstend","email":"e.ndze.it@gmail.com"}],"_npmUser":{"name":"berstend","email":"e.ndze.it@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tiny-request-router_1.1.1_1572803346095_0.9946710073326746"},"_hasShrinkwrap":false},"1.1.2":{"name":"tiny-request-router","version":"1.1.2","description":"Fast, generic and type safe router (match method and path).","author":{"name":"berstend"},"license":"MIT","repository":{"type":"git","url":"https://github.com/berstend/tiny-request-router.git"},"homepage":"https://github.com/berstend/tiny-request-router#readme","main":"./dist/router.js","module":"./dist/router.mjs","unpkg":"./dist/router.min.js","browser":{"./dist/router.js":"./dist/router.browser.js","./dist/router.mjs":"./dist/router.browser.mjs"},"types":"dist/src/router.d.ts","scripts":{"check":"tsc --pretty --noEmit","check:watch":"npm run check -- --watch","declarations":"tsc --emitDeclarationOnly","prebuild":"rimraf dist","build":"rollup -c rollup.config.ts && npm run declarations","dev":"npm run prebuild && rollup -c rollup.config.ts -w && npm run declarations","test":"ava-ts -v","prepublish":"npm run build"},"prettier":{"printWidth":100,"semi":false,"singleQuote":true},"keywords":["router","service worker","universal","routing","cloudflare","worker","browser","node","url router","cloudflare worker","typescript","match request"],"devDependencies":{"@types/node":"^12.11.7","ava":"^2.4.0","ava-ts":"^0.25.1","rimraf":"^3.0.0","rollup":"^1.25.2","rollup-plugin-commonjs":"^10.1.0","rollup-plugin-node-resolve":"^5.2.0","rollup-plugin-terser":"^5.1.2","rollup-plugin-typescript":"^1.0.1","ts-node":"^8.4.1","tslint":"^5.11.0","tslint-config-prettier":"^1.15.0","tslint-config-standard":"^8.0.1","typescript":"^3.0.3"},"dependencies":{"path-to-regexp":"^3.1.0"},"_id":"tiny-request-router@1.1.2","dist":{"shasum":"8518b423d05373552f874b0f784add9c31f820d1","integrity":"sha512-Ppl7LNESwWSr9FEA8mQbPH13yQxOsZnILc1UQ/IK6/weGpZ2KhQ7z5UPlP0NJqDjybzjgp+OlHKm48xyU0z0sw==","tarball":"https://registry.npmjs.org/tiny-request-router/-/tiny-request-router-1.1.2.tgz","fileCount":19,"unpackedSize":241496,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdwCALCRA9TVsSAnZWagAAVpwQAJk0zaeQkDl9mhX3FpvK\nQkjJLX3EfVW3qmRkGIsB3YF1iA/zucMHSOSsSBUGYomGdcCoKJw07ruJiBLk\naiVANEFtZzHD1UgPGOLZlXNRQx7ZRlS24miaiHj0eQwgysGwlKWkKfXEsPmk\nqlt1M4AQxSc/yHK4rsyyEMOaoy57u4V1aCDTYiD1seRvt81Pl02s/H8SXYYn\nJLr5QQ2R3dmYimTZvyoEdxlyrlwHtxrXuANo4h27UsSinHD5sjWRzdJbdPlD\ntiQzBleMv7H5/pe7LId3wN1bW29GJ46bjdcvGZelfbbB3J7UUkpibVc4zSCj\n8Jvra0pBLdLhOmIW1C2muBy1cgCmOt83/Nru+VYi8kUha6SDxmtIBotgAkbU\nBag6bufoYPpYEXJk95vQ900azlGhg3zbdOjGPohKzpAHKg9ccjUabVg8QDTM\n609u1k2bYcB9JO0pmV1dYUOLjc62YfVFFL5JwKbQjnqqrPhmIH1UMK0DwwS0\nMdtQJ8hz64lbovKoaDzfQMDfDaEzJKLKCr4hV+GJxIAP/Nwd2KpV/QKKB63f\nQPV1+Br5NS+z3h1zoWRQ7ZnpVftj6R/0W9RMzdwlCllKh7VXyjXPTe+RpIHh\nBRn4gi5/uEXY4FbjkvivaVT/sFDEYTP+PYrNqdfzgNL2QKAOLR/bT0OfQOBt\nJbq9\r\n=Mv4F\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCktadYXLnTvSi3hELCNgs6TU9P7F/rfIequMzKd6OYvAIhAI8VcUkTqKizEFOOD8lvn3WWJGSazdNAe5vBWL/zPpj7"}]},"maintainers":[{"name":"berstend","email":"e.ndze.it@gmail.com"}],"_npmUser":{"name":"berstend","email":"e.ndze.it@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tiny-request-router_1.1.2_1572872203361_0.2608689328760989"},"_hasShrinkwrap":false},"1.2.2":{"name":"tiny-request-router","version":"1.2.2","description":"Fast, generic and type safe router (match method and path).","author":{"name":"berstend"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/berstend/tiny-request-router.git"},"homepage":"https://github.com/berstend/tiny-request-router#readme","main":"./dist/router.js","module":"./dist/router.mjs","unpkg":"./dist/router.min.js","browser":{"./dist/router.js":"./dist/router.browser.js","./dist/router.mjs":"./dist/router.browser.mjs"},"types":"dist/src/router.d.ts","scripts":{"check":"tsc --pretty --noEmit","check:watch":"npm run check -- --watch","declarations":"tsc --emitDeclarationOnly","prebuild":"rimraf dist","build":"rollup -c rollup.config.ts && npm run declarations","dev":"npm run prebuild && rollup -c rollup.config.ts -w && npm run declarations","test":"ava-ts -v","prepublish":"npm run build","docs":"documentation readme --quiet --shallow --github --markdown-theme transitivebs --readme-file readme.md --section API ./src/router.ts && npx prettier --write readme.md && npx prettier --write readme.md"},"prettier":{"printWidth":100,"semi":false,"singleQuote":true},"keywords":["router","service worker","universal","routing","cloudflare","worker","browser","node","url router","cloudflare worker","typescript","match request"],"devDependencies":{"@types/node":"^12.12.14","ava":"^2.4.0","ava-ts":"^0.25.1","documentation-markdown-themes":"^12.1.5","rimraf":"^3.0.0","rollup":"^1.27.5","rollup-plugin-commonjs":"^10.1.0","rollup-plugin-node-resolve":"^5.2.0","rollup-plugin-terser":"^5.1.2","rollup-plugin-typescript":"^1.0.1","ts-node":"^8.5.4","tslint":"^5.20.1","tslint-config-prettier":"^1.15.0","tslint-config-standard":"^9.0.0","typescript":"^3.7.2"},"dependencies":{"path-to-regexp":"^6.1.0"},"gitHead":"ba18d1d7e67ff19fa058740f16a21bad6d3373ee","bugs":{"url":"https://github.com/berstend/tiny-request-router/issues"},"_id":"tiny-request-router@1.2.2","_nodeVersion":"13.2.0","_npmVersion":"6.13.1","dist":{"integrity":"sha512-6ZMFU7AP9so+hkqmMM9fJ11V44EAcYuHCmNdsyM8k94oVnNDPQwUAAPoBHqchHSpKG6yZbCasgVeRxaY5v2BCg==","shasum":"1b80694497e4e8dcbb8e93851ec7f03c6ca13e75","tarball":"https://registry.npmjs.org/tiny-request-router/-/tiny-request-router-1.2.2.tgz","fileCount":15,"unpackedSize":303296,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd4Yi6CRA9TVsSAnZWagAAuSgP+wT7+7qilWz/hMCkrxBm\ndB8/qfZKFYVFsi5gkFdmmBRey4LOLLbpPnUtDUW2Pb1b9pvvSD/QIHX6ogPi\nn/ZA2mLcv2qscmjTiv9ZllFGdJ7+bLiJBTLJrDihRztbQQDV0EMOONMZ9Xrq\nMV7Mlm7kPC4ZExG16jEKftk5t9rvS2R3DPBoIDeWZWu4Z1jeCPI8PqayGFTP\niEP16laNqvhHbAI+CV/+R0mwiSHftngg9EGjyQpAaYfJuNFAdNQnRkv7yhDj\nwMg3LHtByX0hC6KgKC5KSqtAosM8XRHeBmaBqth4hUtKmgfek18iDs54mYrf\nIyufGjespwu4PEKAuo9NELH++YPK9/DsSUR4zG5mVBDSbX6TU6aPS6UVfB6I\nXrBMzWlYVQQwlezmSfsIvQixRBQIURYqXPs/lNcfAIRqhUBGVoG+mE3X8dV+\nAn7jKFxirSDfMuQ3BLsY3MneBFC4wy7tFcjHfyDnTrNHXJ7COQFSp0LIjqAQ\nPhpELRpqJV1XS2sPosGotuUKtJy7Jhq0Wo1bWZV0NVIaPkFy+N6btcx1XhKg\nv4O63gNugr2Y2+HirGlUFYoRyECCyjHUHGM+yzyFRu4VicUPmE/HhW6W38vv\nA5iTqs8Q2g/tupI++nXDkpkrkWOF1GG7NRxcv/Zv2koTMp2zJQiEychekwff\n1BQz\r\n=Lhz9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICyaU/giKkjvxlLqGFX5kKGqQMyf/J5zlf4lViUnf6nHAiEA9WVzqIvoaU4PAX6d8KQLDM/vuD5UYT/M1koVeJ5sIl4="}]},"maintainers":[{"name":"berstend","email":"e.ndze.it@gmail.com"}],"_npmUser":{"name":"berstend","email":"e.ndze.it@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tiny-request-router_1.2.2_1575061689915_0.5426797299262358"},"_hasShrinkwrap":false}},"time":{"created":"2019-11-03T17:49:06.094Z","1.1.1":"2019-11-03T17:49:06.213Z","modified":"2022-05-21T21:59:10.183Z","1.1.2":"2019-11-04T12:56:43.528Z","1.2.2":"2019-11-29T21:08:10.128Z"},"maintainers":[{"name":"berstend","email":"e.ndze.it@gmail.com"}],"description":"Fast, generic and type safe router (match method and path).","homepage":"https://github.com/berstend/tiny-request-router#readme","keywords":["router","service worker","universal","routing","cloudflare","worker","browser","node","url router","cloudflare worker","typescript","match request"],"repository":{"type":"git","url":"git+https://github.com/berstend/tiny-request-router.git"},"author":{"name":"berstend"},"license":"MIT","readme":"# tiny-request-router [![ ](https://travis-ci.org/berstend/tiny-request-router.svg?branch=master)](https://travis-ci.org/berstend/tiny-request-router) [![ ](https://img.shields.io/npm/v/tiny-request-router.svg)](https://www.npmjs.com/package/tiny-request-router)\n\n> Fast, generic and type safe router (match request method and path).\n\n## Features\n\n- Minimal and opinionless router, can be used in any script and environment.\n- Matches a request method (e.g. `GET`) and a path (e.g. `/foobar`) against a list of routes\n- Uses [path-to-regexp](https://github.com/pillarjs/path-to-regexp), which is used by express and therefore familiar\n- Allows wildcards (e.g. `/user/(.*)/age`) and named parameters (e.g. `/info/:username/:age`)\n- Will not call your handlers automatically, as it only cares about matching\n- Battle hardened in production ([Cloudflare Worker](https://www.cloudflare.com/products/cloudflare-workers/) with 10M requests per day)\n- No magic, no assumptions, no fluff, type safe, tested\n\n### Route testing\n\n- You can use the [Express Route Tester](https://forbeslindesay.github.io/express-route-tester/) (select `2.0.0`) to debug your path patterns quickly\n\n## Installation\n\n```bash\nyarn add tiny-request-router\n# or\nnpm install --save tiny-request-router\n```\n\n## Usage (JavaScript/TypeScript)\n\n```typescript\nimport { Router } from 'tiny-request-router'\n// NodeJS: const { Router } = require('tiny-request-router')\n\nconst router = new Router()\n\nrouter\n  .get('/(v1|v2)/:name/:age', 'foo1')\n  .get('/info/(.*)/export', 'foo2')\n  .post('/upload/user', 'foo3')\n\nconst match1 = router.match('GET', '/v1/')\n// => null\n\nconst match2 = router.match('GET', '/v1/bob/22')\n// => { handler: 'foo1', params: { name: 'bob', age: '22' }, ... }\n```\n\n### Make your handlers type safe (TypeScript)\n\n```typescript\nimport { Router, Method, Params } from 'tiny-request-router'\n\n// Let the router know that handlers are async functions returning a Response\ntype Handler = (params: Params) => Promise<Response>\n\nconst router = new Router<Handler>()\nrouter.all('*', async () => new Response('Hello'))\n\nconst match = router.match('GET' as Method, '/foobar')\nif (match) {\n  // Call the async function of that match\n  const response = await match.handler()\n  console.log(response) // => Response('Hello')\n}\n```\n\n## Example: Cloudflare Workers (JavaScript)\n\n_Use something like [wrangler](https://github.com/cloudflare/wrangler) to bundle the router with your worker code._\n\n```js\nimport { Router } from 'tiny-request-router'\n\nconst router = new Router()\nrouter.get('/worker', async () => new Response('Hi from worker!'))\nrouter.get('/hello/:name', async params => new Response(`Hello ${params.name}!`))\nrouter.post('/test', async () => new Response('Post received!'))\n\n// Main entry point in workers\naddEventListener('fetch', event => {\n  const request = event.request\n  const { pathname } = new URL(request.url)\n\n  const match = router.match(request.method, pathname)\n  if (match) {\n    event.respondWith(match.handler(match.params))\n  }\n})\n```\n\n---\n\n## API\n\n<!-- Generated by documentation.js. Update this documentation by updating the source code. -->\n\n#### Table of Contents\n\n- [Method()](#method)\n- [RouteOptions()](#routeoptions)\n- [RouteMatch()](#routematch)\n- [class: Router](#class-router)\n  - [.routes](#routes)\n  - [.all(path, handler, options)](#allpath-handler-options)\n  - [.get(path, handler, options)](#getpath-handler-options)\n  - [.post(path, handler, options)](#postpath-handler-options)\n  - [.put(path, handler, options)](#putpath-handler-options)\n  - [.patch(path, handler, options)](#patchpath-handler-options)\n  - [.delete(path, handler, options)](#deletepath-handler-options)\n  - [.head(path, handler, options)](#headpath-handler-options)\n  - [.options(path, handler, options)](#optionspath-handler-options)\n  - [.match(method, path)](#matchmethod-path)\n\n### [Method()](https://github.com/berstend/tiny-request-router/blob/5e7d69be1e37a6d2d14c611efe77ba2ef6ea9f83/src/router.ts#L6-L6)\n\nType: **(`\"GET\"` \\| `\"POST\"` \\| `\"PUT\"` \\| `\"PATCH\"` \\| `\"DELETE\"` \\| `\"HEAD\"` \\| `\"OPTIONS\"`)**\n\nValid HTTP methods for matching.\n\n---\n\n### [RouteOptions()](https://github.com/berstend/tiny-request-router/blob/5e7d69be1e37a6d2d14c611efe77ba2ef6ea9f83/src/router.ts#L39-L39)\n\n**Extends: TokensToRegexpOptions**\n\nOptional route options.\n\nExample:\n\n```javascript\n// When `true` the regexp will be case sensitive. (default: `false`)\nsensitive?: boolean;\n\n// When `true` the regexp allows an optional trailing delimiter to match. (default: `false`)\nstrict?: boolean;\n\n// When `true` the regexp will match to the end of the string. (default: `true`)\nend?: boolean;\n\n// When `true` the regexp will match from the beginning of the string. (default: `true`)\nstart?: boolean;\n\n// Sets the final character for non-ending optimistic matches. (default: `/`)\ndelimiter?: string;\n\n// List of characters that can also be \"end\" characters.\nendsWith?: string;\n\n// Encode path tokens for use in the `RegExp`.\nencode?: (value: string) => string;\n```\n\n---\n\n### [RouteMatch()](https://github.com/berstend/tiny-request-router/blob/5e7d69be1e37a6d2d14c611efe77ba2ef6ea9f83/src/router.ts#L67-L70)\n\n**Extends: Route&lt;HandlerType>**\n\nThe object returned when a route matches.\n\nThe handler can then be used to execute the relevant function.\n\nExample:\n\n```javascript\n{\n  params: Params\n  matches?: RegExpExecArray\n  method: Method | MethodWildcard\n  path: string\n  regexp: RegExp\n  options: RouteOptions\n  keys: Keys\n  handler: HandlerType\n}\n```\n\n---\n\n### class: [Router](https://github.com/berstend/tiny-request-router/blob/5e7d69be1e37a6d2d14c611efe77ba2ef6ea9f83/src/router.ts#L86-L168)\n\nTiny request router. Allows overloading of handler type to be fully type safe.\n\nExample:\n\n```javascript\nimport { Router, Method, Params } from 'tiny-request-router'\n\n// Let the router know that handlers are async functions returning a Response\ntype Handler = (params: Params) => Promise<Response>\n\nconst router = new Router<Handler>()\n```\n\n---\n\n#### .[routes](https://github.com/berstend/tiny-request-router/blob/5e7d69be1e37a6d2d14c611efe77ba2ef6ea9f83/src/router.ts#L88-L88)\n\nList of all registered routes.\n\n---\n\n#### .[all(path, handler, options)](https://github.com/berstend/tiny-request-router/blob/5e7d69be1e37a6d2d14c611efe77ba2ef6ea9f83/src/router.ts#L91-L93)\n\n- `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\n- `handler` **HandlerType**\n- `options` **[RouteOptions](#routeoptions)** (optional, default `{}`)\n\nAdd a route that matches any method.\n\n---\n\n#### .[get(path, handler, options)](https://github.com/berstend/tiny-request-router/blob/5e7d69be1e37a6d2d14c611efe77ba2ef6ea9f83/src/router.ts#L95-L97)\n\n- `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\n- `handler` **HandlerType**\n- `options` **[RouteOptions](#routeoptions)** (optional, default `{}`)\n\nAdd a route that matches the GET method.\n\n---\n\n#### .[post(path, handler, options)](https://github.com/berstend/tiny-request-router/blob/5e7d69be1e37a6d2d14c611efe77ba2ef6ea9f83/src/router.ts#L99-L101)\n\n- `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\n- `handler` **HandlerType**\n- `options` **[RouteOptions](#routeoptions)** (optional, default `{}`)\n\nAdd a route that matches the POST method.\n\n---\n\n#### .[put(path, handler, options)](https://github.com/berstend/tiny-request-router/blob/5e7d69be1e37a6d2d14c611efe77ba2ef6ea9f83/src/router.ts#L103-L105)\n\n- `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\n- `handler` **HandlerType**\n- `options` **[RouteOptions](#routeoptions)** (optional, default `{}`)\n\nAdd a route that matches the PUT method.\n\n---\n\n#### .[patch(path, handler, options)](https://github.com/berstend/tiny-request-router/blob/5e7d69be1e37a6d2d14c611efe77ba2ef6ea9f83/src/router.ts#L107-L109)\n\n- `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\n- `handler` **HandlerType**\n- `options` **[RouteOptions](#routeoptions)** (optional, default `{}`)\n\nAdd a route that matches the PATCH method.\n\n---\n\n#### .[delete(path, handler, options)](https://github.com/berstend/tiny-request-router/blob/5e7d69be1e37a6d2d14c611efe77ba2ef6ea9f83/src/router.ts#L111-L113)\n\n- `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\n- `handler` **HandlerType**\n- `options` **[RouteOptions](#routeoptions)** (optional, default `{}`)\n\nAdd a route that matches the DELETE method.\n\n---\n\n#### .[head(path, handler, options)](https://github.com/berstend/tiny-request-router/blob/5e7d69be1e37a6d2d14c611efe77ba2ef6ea9f83/src/router.ts#L115-L117)\n\n- `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\n- `handler` **HandlerType**\n- `options` **[RouteOptions](#routeoptions)** (optional, default `{}`)\n\nAdd a route that matches the HEAD method.\n\n---\n\n#### .[options(path, handler, options)](https://github.com/berstend/tiny-request-router/blob/5e7d69be1e37a6d2d14c611efe77ba2ef6ea9f83/src/router.ts#L119-L121)\n\n- `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\n- `handler` **HandlerType**\n- `options` **[RouteOptions](#routeoptions)** (optional, default `{}`)\n\nAdd a route that matches the OPTIONS method.\n\n---\n\n#### .[match(method, path)](https://github.com/berstend/tiny-request-router/blob/5e7d69be1e37a6d2d14c611efe77ba2ef6ea9f83/src/router.ts#L135-L152)\n\n- `method` **[Method](#method)**\n- `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\n\nReturns: **([RouteMatch](#routematch)&lt;HandlerType> | null)**\n\nMatch the provided method and path against the list of registered routes.\n\nExample:\n\n```javascript\nrouter.get('/foobar', async () => new Response('Hello'))\n\nconst match = router.match('GET', '/foobar')\nif (match) {\n  // Call the async function of that match\n  const response = await match.handler()\n  console.log(response) // => Response('Hello')\n}\n```\n\n---\n\n## More info\n\nPlease check out the [tiny source code](src/router.ts) or [tests](test/functionality.ts) for more info.\n\n## License\n\nMIT\n","readmeFilename":"readme.md","bugs":{"url":"https://github.com/berstend/tiny-request-router/issues"}}