{"id":16348462,"url":"https://github.com/tivac/router","last_synced_at":"2025-04-12T12:31:40.771Z","repository":{"id":57166741,"uuid":"143591968","full_name":"tivac/router","owner":"tivac","description":"Writing a JS router, because I can.","archived":false,"fork":false,"pushed_at":"2018-10-19T05:20:58.000Z","size":275,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-04T07:09:20.557Z","etag":null,"topics":["javascript","routing","single-page-applications"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/tivac.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}},"created_at":"2018-08-05T07:19:42.000Z","updated_at":"2023-09-21T13:12:02.000Z","dependencies_parsed_at":"2022-08-30T15:10:26.697Z","dependency_job_id":null,"html_url":"https://github.com/tivac/router","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tivac%2Frouter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tivac%2Frouter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tivac%2Frouter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tivac%2Frouter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tivac","download_url":"https://codeload.github.com/tivac/router/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248566530,"owners_count":21125680,"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":["javascript","routing","single-page-applications"],"created_at":"2024-10-11T00:52:14.976Z","updated_at":"2025-04-12T12:31:39.142Z","avatar_url":"https://github.com/tivac.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @tivac/router\n\nA very-simple router, inspired by [`page.js`](https://www.npmjs.com/package/page).\n\n(You probably want to use `page.js`, honestly. This is just me experimenting!)\n\n## Usage\n\nInclude in a `\u003cscript\u003e` tag\n\n```html\n\u003cscript src=\"https://unpkg.com/router/dist/router.umd.js\u003e\u003c/script\u003e\n```\n\nOr with `import`\n\n```js\nimport router from \"router\";\n```\n\nOr with `require`\n\n```js\nconst router = require(\"router\");\n```\n\n## API\n\n### `router(path, callback[, callback ...])`\n\nCreate a route mapping `path` to `callback`. See [Route Callbacks](#route-callbacks) for a description of the signature.\n\nReturns the same `router` instance for optional chaining.\n\n`path` supports `/:params` as well as `*` or `/path/*` style wildcards. No regex stuff though.\n\n### `router.go(path, fn)`\n\nBegin route matching for a path. `fn` will be called when all matched route handlers are complete.\n\n### `router.unknown(fn)`\n\nDefine a `fn` that will be called when a route handler cannot be found.\n\n## Route Callbacks\n\nRoute callbacks are passed two arguments:\n\n1. `ctx`, a shared object available to all handlers of a request\n2. `next()`, a function that will invoke any further route handlers.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftivac%2Frouter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftivac%2Frouter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftivac%2Frouter/lists"}