{"id":19551382,"url":"https://github.com/briward/raptor-router","last_synced_at":"2025-02-26T07:16:31.780Z","repository":{"id":260147297,"uuid":"880363093","full_name":"briward/raptor-router","owner":"briward","description":"The first-party router extension for Raptor.","archived":false,"fork":false,"pushed_at":"2024-11-11T18:50:23.000Z","size":89,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-08T20:22:54.905Z","etag":null,"topics":["deno","raptor","typescript"],"latest_commit_sha":null,"homepage":"","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/briward.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}},"created_at":"2024-10-29T15:34:31.000Z","updated_at":"2024-11-11T18:50:27.000Z","dependencies_parsed_at":"2025-01-08T20:22:49.371Z","dependency_job_id":"7642e972-9663-466f-9084-c5c5164abb65","html_url":"https://github.com/briward/raptor-router","commit_stats":null,"previous_names":["briward/raptor-router"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briward%2Fraptor-router","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briward%2Fraptor-router/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briward%2Fraptor-router/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briward%2Fraptor-router/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/briward","download_url":"https://codeload.github.com/briward/raptor-router/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240807563,"owners_count":19860772,"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","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","raptor","typescript"],"created_at":"2024-11-11T04:13:43.177Z","updated_at":"2025-02-26T07:16:31.718Z","avatar_url":"https://github.com/briward.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./assets//logo.png\" width=\"300\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/briward/raptor-router/actions\"\u003e\u003cimg src=\"https://github.com/briward/raptor-router/workflows/ci/badge.svg\" alt=\"Build Status\"\u003e\u003c/a\u003e\n  \u003ca href=\"jsr.io/@raptor/router\"\u003e\u003cimg src=\"https://jsr.io/badges/@raptor/router?logoColor=3A9D95\u0026color=3A9D95\u0026labelColor=083344\" /\u003e\u003c/a\u003e\n  \u003ca href=\"jsr.io/@raptor/router score\"\u003e\u003cimg src=\"https://jsr.io/badges/@raptor/router/score?logoColor=3A9D95\u0026color=3A9D95\u0026labelColor=083344\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://jsr.io/@raptor\"\u003e\u003cimg src=\"https://jsr.io/badges/@raptor?logoColor=3A9D95\u0026color=3A9D95\u0026labelColor=083344\" alt=\"\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# About Raptor\n\nSee more information about the Raptor framework here: \u003ca href=\"https://jsr.io/@raptor/framework\"\u003ehttps://jsr.io/@raptor/framework\u003c/a\u003e.\n\n# Usage\n\n\u003e [!NOTE]\n\u003e This is currently under heavy development and is not yet suitable for production use. Please proceed with caution.\n\n## Installation\n\nTo start using the router, simply install into an existing Raptor application via the CLI or import it directly from JSR.\n\n### Using the Deno CLI\n\n```\ndeno add jsr:@raptor/router\n```\n\n### Importing with JSR\n\nRaptor is also available to import directly via JSR:\n[https://jsr.io/@raptor/router](https://jsr.io/@raptor/router)\n\n## Usage\n\nThe built-in router operates similarly to standard Raptor middleware, enabling you to define routes using Web API standard URL patterns. For further details, visit [mozilla.org/URLPattern](https://developer.mozilla.org/en-US/docs/Web/API/URLPattern).\n\n### Adding routes to the router\n\n```ts\nimport { Kernel, Context } from \"jsr:@raptor/framework\";\nimport { Router, Route, HttpMethod } from \"jsr:@raptor/router\";\n\nconst app = new Kernel();\n\nconst router = new Router();\n\nconst route = new Route({\n  name: \"index\",\n  method: HttpMethod.GET,\n  pathname: \"/\",\n  handler: () =\u003e 'Hello, Dr Malcolm!'\n});\n\nrouter.add(route);\n\napp.add((context: Context) =\u003e router.handler(context));\n\napp.serve({ port: 8000 });\n```\n\n### Route parameters\n\nRoute parameter values are processed and available via the router's context object (`context.params`) if they are found in the route's pathname. Make sure to import the router's `Context` object, rather than the base Raptor `Context` object.\n\n```ts\nimport { Route, Context, HttpMethod } from \"jsr:@raptor/router\";\n\n/* ... */\n\nconst route = new Route({\n  name: \"person.read\",\n  method: HttpMethod.GET,\n  pathname: \"/person/:name\";\n  handler: (context: Context) =\u003e {\n    const { name } = context.params;\n\n    return `Hello ${name}`;\n  }\n});\n```\n\n# License\n\n_Copyright 2024, @briward. All rights reserved. The framework is licensed under\nthe MIT license._\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriward%2Fraptor-router","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbriward%2Fraptor-router","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriward%2Fraptor-router/lists"}