{"_id":"@bjorkhaug/srouter","_rev":"1-913ffab9d490ae13dd69ae67c6a5e9b3","name":"@bjorkhaug/srouter","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"module":"./esm/mod.js","main":"./script/mod.js","name":"@bjorkhaug/srouter","version":"0.0.1","description":"Simple strict routing for Deno","license":"MIT","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/","scope":"@bjorkhaug"},"dependencies":{"@bjorkhaug/smethod":"^0.0.1","@bjorkhaug/surl":"^0.0.1"},"peerDependencies":{"@bjorkhaug/sreflect":"^0.0.2"},"repository":{"type":"git","url":"git+https://github.com/simenbjorkhaug/srouter.git"},"bugs":{"url":"https://github.com/simenbjorkhaug/srouter/issues"},"exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"devDependencies":{"@types/node":"^18.11.9"},"_id":"@bjorkhaug/srouter@0.0.1","gitHead":"d41be4c437e992f7386319fde69c1e336d8ac809","types":"./script/mod.d.ts","homepage":"https://github.com/simenbjorkhaug/srouter#readme","_nodeVersion":"21.2.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-/xGjyVxV7j93On5rIoWhrJvAP3ChZeq8ob8kGqmTBruo5vC4Xy8OSBNrQ4yQOkK8n/KjPrnY4fAj6LiZ1VK2EQ==","shasum":"dd2efa3f33ac7380371b7e3456279215869e2b5d","tarball":"https://registry.npmjs.org/@bjorkhaug/srouter/-/srouter-0.0.1.tgz","fileCount":32,"unpackedSize":17901,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD+7lFnJ+bKgPBlly/X4vZODuYE7+l5cO9z88R8T5lXFAIhAMjlW7l4ZnMMB2Fn46TfSRWnj3qclnl5VKlX+c+us5Bi"}]},"_npmUser":{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"},"directories":{},"maintainers":[{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/srouter_0.0.1_1700232697360_0.2074310507574173"},"_hasShrinkwrap":false},"0.0.2":{"module":"./esm/mod.js","main":"./script/mod.js","name":"@bjorkhaug/srouter","version":"0.0.2","description":"Simple strict routing for Deno","license":"MIT","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/","scope":"@bjorkhaug"},"peerDependencies":{"@bjorkhaug/sreflect":"^0.0.2","@bjorkhaug/smethod":"^0.0.1","@bjorkhaug/surl":"^0.0.1"},"repository":{"type":"git","url":"git+https://github.com/simenbjorkhaug/srouter.git"},"bugs":{"url":"https://github.com/simenbjorkhaug/srouter/issues"},"exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"dependencies":{"@bjorkhaug/smethod":"*","@bjorkhaug/surl":"*"},"devDependencies":{"@types/node":"^18.11.9"},"_id":"@bjorkhaug/srouter@0.0.2","gitHead":"eed5bac124ff7b0f5877d72c19db6b65064e357d","types":"./script/mod.d.ts","homepage":"https://github.com/simenbjorkhaug/srouter#readme","_nodeVersion":"21.2.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-pogbSe96M1LNt+6qp3fUQqVtR/NHmhz8uxxAdNXOmGD9AutwP4d37HMpbsZX1rkUkYGO+E6p4/fSV78fQKlaNw==","shasum":"ea9b8a5722b239b2717b315a17797f6526bd428a","tarball":"https://registry.npmjs.org/@bjorkhaug/srouter/-/srouter-0.0.2.tgz","fileCount":32,"unpackedSize":17784,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICg1UrdvRZFBAu1zvC5WqzgxBMdSAeCE1YDP4lfJ2mm4AiB3on/Qvtyg1Q0t7vPgo4ccyt4VvOoSKOg95evDWVWEkg=="}]},"_npmUser":{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"},"directories":{},"maintainers":[{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/srouter_0.0.2_1700234253227_0.39661849261899085"},"_hasShrinkwrap":false}},"time":{"created":"2023-11-17T14:51:37.208Z","0.0.1":"2023-11-17T14:51:37.557Z","modified":"2023-11-17T15:17:33.616Z","0.0.2":"2023-11-17T15:17:33.405Z"},"maintainers":[{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"}],"description":"Simple strict routing for Deno","homepage":"https://github.com/simenbjorkhaug/srouter#readme","repository":{"type":"git","url":"git+https://github.com/simenbjorkhaug/srouter.git"},"bugs":{"url":"https://github.com/simenbjorkhaug/srouter/issues"},"license":"MIT","readme":"# @bjorkhaug/srouter\n\nThis is a TypeScript library that provides routing and middleware functionality\nfor Deno built applications. It works in harmony with `npm:@bjorkhaug/smethods`\nand `npm:@bjorkhaug/surl`.\n\n## Features\n\n- **Routing**: The library provides a `route` function that allows you to define\n  routes for your application. Each route is associated with a specific\n  controller method that handles requests to that route.\n\n- **Middleware**: Middleware functions are functions that have access to the\n  request object, state can be populated on a passed controller instance.\n  Middlewares can be on a per route or per controller basis.\n\n- **Error Handling**: The library provides a `Catch` decorator that allows you\n  to define error handling logic for your routes. The catch decorator, if not\n  returning a responds bubbles the error.\n\n## Getting Started\n\nTo use this library, you need to import the necessary functions and decorators\nfrom the main module:\n\n```typescript\nimport { route, router } from 'npm:@bjorkhaug/srouter'\n```\n\nThen you can defined Controllers, routes and middleware:\n\n```typescript\nclass MyController {\n  @Get('/')\n  index() {\n    return new Response('Hello world', {\n      headers: {\n        'Content-Type': 'text/plain',\n      },\n    })\n  }\n}\n```\n\nSetting up the router and routes:\n\n```typescript\nDeno.serve(..., async (request: Request) => { \n    const response = await router(\n        () => route(request, new MyController())\n    )\n})\n```\n\nThis follows a pattern for a controller per route. The routes are also strict,\nmeaning it will match the first route from the first controller\\\nthat has a match for that particular route.\n","readmeFilename":"README.md"}