{"id":26804422,"url":"https://github.com/prybet/router","last_synced_at":"2026-05-18T19:02:40.334Z","repository":{"id":279298658,"uuid":"938353932","full_name":"Prybet/router","owner":"Prybet","description":"A lightweight and flexible router for Deno, built on `@std/route`. Supports dynamic routes, static file serving, and CORS.","archived":false,"fork":false,"pushed_at":"2025-10-03T21:16:00.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-03T22:28:26.665Z","etag":null,"topics":["deno","jsr","router","ts"],"latest_commit_sha":null,"homepage":"https://jsr.io/@prybet/router","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Prybet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-24T20:26:47.000Z","updated_at":"2025-10-03T21:15:32.000Z","dependencies_parsed_at":"2025-02-24T21:32:57.068Z","dependency_job_id":"61e10231-53f8-4bbc-bc45-dda965c2a003","html_url":"https://github.com/Prybet/router","commit_stats":null,"previous_names":["prybet/router"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Prybet/router","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prybet%2Frouter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prybet%2Frouter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prybet%2Frouter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prybet%2Frouter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Prybet","download_url":"https://codeload.github.com/Prybet/router/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prybet%2Frouter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279005646,"owners_count":26083940,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deno","jsr","router","ts"],"created_at":"2025-03-29T22:16:39.806Z","updated_at":"2025-10-11T00:07:05.401Z","avatar_url":"https://github.com/Prybet.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @prybet/router\n\nA lightweight and flexible router for Deno, built on `@std/route`. Supports dynamic routes, static file serving, and CORS.\n\n## 📝 About this project\n\nI created this router to use it across multiple projects without repeating code.  \nThe idea came from a public project by [Fireship](https://github.com/fireship-io) in a [Deno 2.0 course](https://github.com/fireship-io/deno-course), where he has a similar class.  \nI modified it with **ChatGPT** to fit my needs, adding **CORS support** and **static file serving**.\n\nIts syntax and abstraction are inspired by **Express.js**, making it easy to use for those familiar with it.  \nIt provides a simple and flexible API to define routes, handle requests, and serve static files, without requiring a complex setup.\n\n## 🚀 Installation\n\nYou can install this package from JSR:\n\n```ts\nimport { Router } from \"jsr:@prybet/router\";\n```\n\n## 📌 Features\n\n- 🛠 **Dynamic Routing** (`:params` support)\n- 📁 **Static File Serving**\n- 🌍 **CORS Support**\n- ⚡ **Lightweight \u0026 Fast**\n\n## 🛠 Usage\n\n### **Basic Example**\n\n```ts\nimport { Router } from \"jsr:@prybet/router\";\n\nconst app = new Router();\n\napp.get(\"/\", (_, res) =\u003e res.send({ message: \"Hello, world!\" }));\n\n// Route with dynamic params\napp.get(\"/users/:id\", (_, res, params) =\u003e res.send({ userId: params?.id }));\n\n// Route to handle query parameters (?key=value)\napp.get(\"/search\", (_, res, __, queries) =\u003e res.send({ query: queries }));\n\n// Route to send binary data (PDF, images, etc.)\napp.get(\"/pdf\", async (_, res) =\u003e {\n  const pdf = await Deno.readFile(\"./example.pdf\");\n  return res.setHeader(\"Content-Type\", \"application/pdf\").send(pdf.buffer);\n});\n\n// Route to send SVG\napp.get(\"/svg\", (_, res) =\u003e {\n  const svg = `\u003csvg xmlns=\"http://www.w3.org/2000/svg\" width=\"100\" height=\"100\"\u003e\n  \u003ccircle cx=\"50\" cy=\"50\" r=\"40\" fill=\"red\" /\u003e\n\u003c/svg\u003e`;\n  return res.setHeader(\"Content-Type\", \"image/svg+xml\").send(svg);\n});\n\napp.cors(); // Enable CORS\n\nDeno.serve({ port: 9090 }, (req) =\u003e app.handler(req));\n```\n\n### **Serving Static Files**\n\n```ts\napp.static(\"/public\", \"./static\");\n```\n\n## 🔬 Testing\n\nTo run tests:\n\n```sh\ndeno test --allow-net\n```\n\n## 📜 License\n\nMIT\n\n\u003csmall\u003eThis README.md document was created with the help of AI.\u003c/small\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprybet%2Frouter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprybet%2Frouter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprybet%2Frouter/lists"}