{"id":22556240,"url":"https://github.com/substrate-system/routes","last_synced_at":"2026-02-15T21:04:18.171Z","repository":{"id":221620888,"uuid":"754869821","full_name":"substrate-system/routes","owner":"substrate-system","description":"Route matcher devised for shared rendering JavaScript applications","archived":false,"fork":false,"pushed_at":"2026-01-02T04:57:52.000Z","size":86,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-07T23:10:19.901Z","etag":null,"topics":["router"],"latest_commit_sha":null,"homepage":"https://substrate-system.github.io/routes/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/substrate-system.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2024-02-08T23:08:03.000Z","updated_at":"2026-01-02T04:57:49.000Z","dependencies_parsed_at":"2025-01-10T04:34:15.557Z","dependency_job_id":"03435c97-a4f6-40de-a0bf-08e61bc28e5c","html_url":"https://github.com/substrate-system/routes","commit_stats":{"total_commits":29,"total_committers":4,"mean_commits":7.25,"dds":0.5862068965517242,"last_synced_commit":"90171cef574f2e46fa9742c13385393f55cd271b"},"previous_names":["nichoth/routes","substrate-system/routes","bicycle-codes/routes"],"tags_count":14,"template":false,"template_full_name":"nichoth/template-ts-browser","purl":"pkg:github/substrate-system/routes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substrate-system%2Froutes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substrate-system%2Froutes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substrate-system%2Froutes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substrate-system%2Froutes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/substrate-system","download_url":"https://codeload.github.com/substrate-system/routes/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substrate-system%2Froutes/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29489355,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T19:29:10.908Z","status":"ssl_error","status_checked_at":"2026-02-15T19:29:10.419Z","response_time":118,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["router"],"created_at":"2024-12-07T19:11:41.160Z","updated_at":"2026-02-15T21:04:18.166Z","avatar_url":"https://github.com/substrate-system.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# routes\n[![tests](https://img.shields.io/github/actions/workflow/status/substrate-system/routes/nodejs.yml?style=flat-square)](https://github.com/substrate-system/routes/actions/workflows/nodejs.yml)\n[![types](https://img.shields.io/npm/types/@substrate-system/routes?style=flat-square)](README.md)\n[![module](https://img.shields.io/badge/module-ESM%2FCJS-blue?style=flat-square)](README.md)\n[![dependencies](https://img.shields.io/badge/dependencies-zero-brightgreen.svg?style=flat-square)](package.json)\n[![install size](https://flat.badgen.net/packagephobia/install/@substrate-system/routes?cache-control=no-cache)](https://packagephobia.com/result?p=@@substrate-system/routes/keys)\n[![GZip size](https://flat.badgen.net/bundlephobia/minzip/@substrate-system/routes)](https://bundlephobia.com/package/@substrate-system/routes)\n[![semantic versioning](https://img.shields.io/badge/semver-2.0.0-brightgreen?logo=semver\u0026style=flat-square)](https://semver.org/)\n[![license](https://img.shields.io/badge/license-Big_Time-blue?style=flat-square)](LICENSE)\n\n\nRoute matcher devised for shared rendering JavaScript applications\n\n\u003cdetails\u003e\u003csummary\u003e\u003ch2\u003eContents\u003c/h2\u003e\u003c/summary\u003e\n\u003c!-- toc --\u003e\n\u003c/details\u003e\n\n\n## Install\n```sh\nnpm install -S @substrate-system/routes\n```\n\n## ESM vs CJS\nFeaturing ESM or CJS versions via `package.json` `exports` field.\n\n```js\n// esm\nimport Router from '@substrate-system/routes'\n```\n\n```js\n// cjs\nconst Router = require('@substrate-system/routes').default\n```\n\n## Example\nGet a router instance\n\n```js\nimport Router from '@substrate-system/routes'\nvar router = new Router()\n```\n\n### Add some routes\n```js\nrouter.addRoute('/articles', getArticles);\nrouter.addRoute('/articles/:slug', getArticleBySlug);\nrouter.addRoute('/articles/search/*', searchForArticles);\n\n// can also chain the method calls\nrouter\n    .addRoute('/foo', () =\u003e {/* ... */})\n    .addRoute('/bar', () =\u003e {/* ... */})\n```\n\n### Find a match\n\n```js\nconst match = router.match('/articles');\n// =\u003e RouteMatch\n```\n\n#### The match object\n```ts\ninterface RouteMatch {\n    params:Record\u003cstring, string\u003e;  // \u003c-- e.g. { slug: 'article-title' }\n    splats:string[];\n    route:string;\n    next?:((...any)=\u003eany)|null;\n    action?:(...any)=\u003eany;\n    index?:number;\n}\n```\n\nYou'll get `null` back if no route matches the provided URL. Otherwise, the\nroute match will provide all the useful information you need inside an object.\n\nKey               | Description\n------------------|---------------------------------------------------------------------------------------\n`action`          | The action passed to `addRoute` as a second argument. Using a function is recommended\n`next`            | Fall through to the next route, or `null` if no other routes match\n`route`           | The route passed to `addRoute` as the first argument\n`params`          | An object containing the values for named parameters in the route\n`splats`          | An object filled with the values for wildcard parameters\n\n## fork\n\nThis is a fork of [ruta3](https://www.npmjs.com/package/ruta3), just adding types.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubstrate-system%2Froutes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsubstrate-system%2Froutes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubstrate-system%2Froutes/lists"}