{"_id":"@bjorkhaug/sfile-router","_rev":"6-42e12699c7c3016f0d77ea2cb5f1dbd1","name":"@bjorkhaug/sfile-router","dist-tags":{"latest":"0.0.7"},"versions":{"0.0.1":{"module":"./esm/mod.js","main":"./script/mod.js","name":"@bjorkhaug/sfile-router","version":"0.0.1","description":"Small file router for using files as routes in deno.","license":"MIT","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/","scope":"@bjorkhaug"},"repository":{"type":"git","url":"git+https://github.com/simenbjorkhaug/sfile-router.git"},"bugs":{"url":"https://github.com/simenbjorkhaug/sfile-router/issues"},"exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"dependencies":{"@deno/shim-deno":"~0.16.1"},"devDependencies":{"@types/node":"^18.11.9"},"_id":"@bjorkhaug/sfile-router@0.0.1","gitHead":"fd0d302570c998806b752586a028f78630f7e9ac","types":"./script/mod.d.ts","homepage":"https://github.com/simenbjorkhaug/sfile-router#readme","_nodeVersion":"21.6.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-3RX4iR2l/yYZzvtGGfs1OsmxLSiVixxa/k1igrCHUXmLir2MvF+QYsnQUD/IYMIoBkCFSuFwfg1UUjMf4VdncQ==","shasum":"750fc526983de2491333abbf77e41729017c3646","tarball":"https://registry.npmjs.org/@bjorkhaug/sfile-router/-/sfile-router-0.0.1.tgz","fileCount":300,"unpackedSize":381030,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDSmVFDePL7kxgCBSlWieVqAenYMDyfyQfgMGZgFS6atQIgFu8rvewJ3OBgHaKWK+bfvMzN/2apLL29fAy2yd3XPhg="}]},"_npmUser":{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"},"directories":{},"maintainers":[{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sfile-router_0.0.1_1706706148243_0.29171398817392147"},"_hasShrinkwrap":false},"0.0.2":{"module":"./esm/mod.js","main":"./script/mod.js","name":"@bjorkhaug/sfile-router","version":"0.0.2","description":"Small file router for using files as routes in deno.","license":"MIT","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/","scope":"@bjorkhaug"},"repository":{"type":"git","url":"git+https://github.com/simenbjorkhaug/sfile-router.git"},"bugs":{"url":"https://github.com/simenbjorkhaug/sfile-router/issues"},"exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"dependencies":{"@deno/shim-deno":"~0.16.1"},"devDependencies":{"@types/node":"^18.11.9"},"_id":"@bjorkhaug/sfile-router@0.0.2","gitHead":"366f48ad1351b43aa313646f516c4b8726ea52e4","types":"./script/mod.d.ts","homepage":"https://github.com/simenbjorkhaug/sfile-router#readme","_nodeVersion":"21.6.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-1v45tg1L9YXiHA3u1ZkMZTfBQvR4KAGXkZg3yyPhDasEIlr1JEyLSXjiIwrySddj93dabjz0jJFLZMWqGVbmbw==","shasum":"724c7961100eeb0d59fda247909b310b3c2ca41d","tarball":"https://registry.npmjs.org/@bjorkhaug/sfile-router/-/sfile-router-0.0.2.tgz","fileCount":300,"unpackedSize":381152,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIB9UMp8rBaqkncuWLQn8jNK7agtHpdzpRbunEG0pf2AAAiEAj5mfL5nJTYzjsS9K0489w5c87luN4sinyggGKdabXt0="}]},"_npmUser":{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"},"directories":{},"maintainers":[{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sfile-router_0.0.2_1706707065582_0.42404225748921265"},"_hasShrinkwrap":false},"0.0.3":{"module":"./esm/mod.js","main":"./script/mod.js","name":"@bjorkhaug/sfile-router","version":"0.0.3","description":"Small file router for using files as routes in deno.","license":"MIT","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/","scope":"@bjorkhaug"},"repository":{"type":"git","url":"git+https://github.com/simenbjorkhaug/sfile-router.git"},"bugs":{"url":"https://github.com/simenbjorkhaug/sfile-router/issues"},"exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"dependencies":{"@deno/shim-deno":"~0.16.1"},"devDependencies":{"@types/node":"^18.11.9"},"_id":"@bjorkhaug/sfile-router@0.0.3","gitHead":"72982e23881f80e7be9f6e3b91090fc6cd13086d","types":"./script/mod.d.ts","homepage":"https://github.com/simenbjorkhaug/sfile-router#readme","_nodeVersion":"21.6.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-5/Q7Y4iIpgJ5gE4+oQ6m4cA8lCQTxykolRGvahDZRYrru9w8G9pd0K0I2wjWr4hxT4GG5AROoudv5UXU8eVgbA==","shasum":"207e25a2eab0c584343f71a260a6e6618f244e0b","tarball":"https://registry.npmjs.org/@bjorkhaug/sfile-router/-/sfile-router-0.0.3.tgz","fileCount":300,"unpackedSize":381270,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDyHmostTBdRPdbP91idXuPloNdYObeYfHAPu3DjkMqnAiEA62FLfcSaxMfImGJZ24AUATzI2USNADeuTlxsA7oJNpw="}]},"_npmUser":{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"},"directories":{},"maintainers":[{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sfile-router_0.0.3_1706707427464_0.7084199452862379"},"_hasShrinkwrap":false},"0.0.4":{"module":"./esm/mod.js","main":"./script/mod.js","name":"@bjorkhaug/sfile-router","version":"0.0.4","description":"Small file router for using files as routes in deno.","license":"MIT","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/","scope":"@bjorkhaug"},"repository":{"type":"git","url":"git+https://github.com/simenbjorkhaug/sfile-router.git"},"bugs":{"url":"https://github.com/simenbjorkhaug/sfile-router/issues"},"exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"dependencies":{"@deno/shim-deno":"~0.16.1"},"devDependencies":{"@types/node":"^18.11.9"},"_id":"@bjorkhaug/sfile-router@0.0.4","gitHead":"2a6c01410d51b680509df6aa2a0b7fa14488799b","types":"./script/mod.d.ts","homepage":"https://github.com/simenbjorkhaug/sfile-router#readme","_nodeVersion":"21.6.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-ahwbwGZRcQ8xOLWMhvQXO/JWUf7L6klMfdB/po9fSGPy/RHpjIj2NO0qPn5ze9Jk59WwW7kfGjcbd4wCOEbD3w==","shasum":"31575a77fcbdf1448d6a6a93783e1f379cf88731","tarball":"https://registry.npmjs.org/@bjorkhaug/sfile-router/-/sfile-router-0.0.4.tgz","fileCount":300,"unpackedSize":382458,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCDOLNJph0OzGLL93b/Ndf/3JkiMLWjnS9KvCAc16/65AIgbHuP/SmGpnxyCeO94HsxAPK8IRAfBQ7wdBiNBa6cqFw="}]},"_npmUser":{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"},"directories":{},"maintainers":[{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sfile-router_0.0.4_1707257529737_0.19998510447665274"},"_hasShrinkwrap":false},"0.0.5":{"module":"./esm/mod.js","main":"./script/mod.js","name":"@bjorkhaug/sfile-router","version":"0.0.5","description":"Small file router for using files as routes in deno.","license":"MIT","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/","scope":"@bjorkhaug"},"repository":{"type":"git","url":"git+https://github.com/simenbjorkhaug/sfile-router.git"},"bugs":{"url":"https://github.com/simenbjorkhaug/sfile-router/issues"},"exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"dependencies":{"@deno/shim-deno":"~0.16.1"},"devDependencies":{"@types/node":"^18.11.9"},"_id":"@bjorkhaug/sfile-router@0.0.5","gitHead":"dcbf0e70cbee0265449ca5e81703342ab4d513eb","types":"./script/mod.d.ts","homepage":"https://github.com/simenbjorkhaug/sfile-router#readme","_nodeVersion":"21.6.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-uwoJLuWoN/PsarVWvBteme/rXzYXdWI9jJd9To6QFgVkb0Zg1Xdr4brAn4weC7a5lkURYLDlDGd0gfP9HVX10Q==","shasum":"0365113a28c39238efb74ec4f26be8ef248f9686","tarball":"https://registry.npmjs.org/@bjorkhaug/sfile-router/-/sfile-router-0.0.5.tgz","fileCount":300,"unpackedSize":382394,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGkQxXrIkGefblTbfVMyXuWJpRvroZTzQppUGJw/hHByAiEAqTQFIhlcwOdHztGqd6NOtX3h9nW0Ie6EnyaQqhuckjY="}]},"_npmUser":{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"},"directories":{},"maintainers":[{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sfile-router_0.0.5_1707258415689_0.8873844244885323"},"_hasShrinkwrap":false},"0.0.6":{"module":"./esm/mod.js","main":"./script/mod.js","name":"@bjorkhaug/sfile-router","version":"0.0.6","description":"Small file router for using files as routes in deno.","license":"MIT","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/","scope":"@bjorkhaug"},"repository":{"type":"git","url":"git+https://github.com/simenbjorkhaug/sfile-router.git"},"bugs":{"url":"https://github.com/simenbjorkhaug/sfile-router/issues"},"exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"dependencies":{"@deno/shim-deno":"~0.16.1"},"devDependencies":{"@types/node":"^18.11.9"},"_id":"@bjorkhaug/sfile-router@0.0.6","gitHead":"98f3a22b95095ba68a357eb6575049b2432d08b3","types":"./script/mod.d.ts","homepage":"https://github.com/simenbjorkhaug/sfile-router#readme","_nodeVersion":"21.6.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-OueGpvq7IRDSgV5TlFWpG6BV/0amhiFlyk7/wFOCRs0goQ1OEPINTRRrsrjI4L/t3LjoVKMZBNjLEWBQxtc/Ww==","shasum":"46a0baff982182519914ab107f5c3faf4009afa6","tarball":"https://registry.npmjs.org/@bjorkhaug/sfile-router/-/sfile-router-0.0.6.tgz","fileCount":300,"unpackedSize":383614,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCd2SUkkUrL7FJUtAXyHyJzvl6izb8nBhdQgg80XwDeMAIhAJ7PeGpB4uNf/JepbZgHKNqAeCJSs2uW11ju6/tWTMVi"}]},"_npmUser":{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"},"directories":{},"maintainers":[{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sfile-router_0.0.6_1707337698130_0.8903715156288987"},"_hasShrinkwrap":false},"0.0.7":{"module":"./esm/mod.js","main":"./script/mod.js","name":"@bjorkhaug/sfile-router","version":"0.0.7","description":"Small file router for using files as routes in deno.","license":"MIT","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/","scope":"@bjorkhaug"},"repository":{"type":"git","url":"git+https://github.com/simenbjorkhaug/sfile-router.git"},"bugs":{"url":"https://github.com/simenbjorkhaug/sfile-router/issues"},"exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"dependencies":{"@deno/shim-deno":"~0.16.1"},"devDependencies":{"@types/node":"^18.11.9"},"_id":"@bjorkhaug/sfile-router@0.0.7","gitHead":"9ea6add93011829a396598b3635b03dd9b9073dd","types":"./script/mod.d.ts","homepage":"https://github.com/simenbjorkhaug/sfile-router#readme","_nodeVersion":"21.6.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-aH82IHg7jOoraEQD43H43wUa+l8QEwBOQ9CALstIhPt/mzr0WFnB+hb4eM9TSacsUDfMQ68I49uq91bRDovi1w==","shasum":"57e5f8f7502ad63928fa97e58afe0a7f58be4fbb","tarball":"https://registry.npmjs.org/@bjorkhaug/sfile-router/-/sfile-router-0.0.7.tgz","fileCount":300,"unpackedSize":383556,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCAskjvrluYAyeT+CXdy+oWyB4Cw9je8EhesuQHD5bTiQIhAL67r+MXkf1tKS2ylnsC0GFiZqgmMFG6ka+r45MEyX0A"}]},"_npmUser":{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"},"directories":{},"maintainers":[{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sfile-router_0.0.7_1707505018204_0.8172106151111491"},"_hasShrinkwrap":false}},"time":{"created":"2024-01-31T13:02:28.121Z","0.0.1":"2024-01-31T13:02:28.395Z","modified":"2024-02-09T18:56:58.538Z","0.0.2":"2024-01-31T13:17:45.792Z","0.0.3":"2024-01-31T13:23:47.680Z","0.0.4":"2024-02-06T22:12:09.943Z","0.0.5":"2024-02-06T22:26:55.867Z","0.0.6":"2024-02-07T20:28:18.305Z","0.0.7":"2024-02-09T18:56:58.357Z"},"maintainers":[{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"}],"description":"Small file router for using files as routes in deno.","homepage":"https://github.com/simenbjorkhaug/sfile-router#readme","repository":{"type":"git","url":"git+https://github.com/simenbjorkhaug/sfile-router.git"},"bugs":{"url":"https://github.com/simenbjorkhaug/sfile-router/issues"},"license":"MIT","readme":"# Deno file based router ( simple poc )\n\nContains code to setup a file based routing system. Does not support splat\nroutes, but handles 404. Must be run with read file permission, `--allow-read`.\nRoutes must be defined in a top level `routes` folder, i.e\n`routes/example.ts -> /example` You expose the method from named exports in the\nfile. See example.\n\n## Setup\n\n```typescript\nimport {\n  configureRoutes,\n  createRequestHandler,\n} from 'npm:@bjorkhaug/sfile-router'\n\nawait configureRoutes()\n\nDeno.serve((request) => {\n  return createRequestHandler(request)\n})\n```\n\n### Usage\n\n```typescript\nimport type { RequestHandlerArgs } from 'npm:@bjorkhaug/sfile-router'\n\nexport const GET = function({ params }: RequestHandlerArgs) {\n    return new Response(JSON.stringify({ hello: params.get('message') })), {\n        headers: {\n            'Content-Type': 'application/json'\n        }\n    })\n}\n```\n\nYou can export any http method as an all capsed function name, this is because\nin strict mode delete in lowercase is reserved. The router only supports one\nmethod decleration per file, so you cannot have multiple get.\\\nRoutes support params by enclosing the route segment in brackets `[param]`. An\nexample of a param route: `example.[param].ts -> /example/:param`. A route can\nbe grouped by prepending a prefix with an underscore, meaning that part of the\nurl will be ignored, not this is only for the first part of the path at this\ntime, example: `_auth.login.password.ts -> /login/password`. If you need to\nescape a dot in the path, you can do so by using parantesis:\n`_auth.auth.(.)well-known.ts -> /auth/.well-known`\n\nYou can customize the behavior of not found or method not allowed ( non defined\nmethods, but the route exists ) to handle this with custom logic as\ncreateRequestHandler just returns a response by default. By passing an option to\nthe configureRoutes function.\n\n```typescript\nimport { configureRoutes } from 'npm:@bjorkhaug/sfile-router'\n\nawait configureRoutes({\n  config: {\n    shouldThrow: true,\n  },\n})\n```\n","readmeFilename":"README.md"}