{"id":13565774,"url":"https://github.com/doesdev/rage-route","last_synced_at":"2026-01-15T22:37:48.887Z","repository":{"id":65480001,"uuid":"98944736","full_name":"doesdev/rage-route","owner":"doesdev","description":"Tiny, feature lite, super basic client router","archived":false,"fork":false,"pushed_at":"2024-09-27T06:50:05.000Z","size":140,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-10T18:02:48.179Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/doesdev.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":"2017-08-01T01:17:16.000Z","updated_at":"2023-03-24T02:39:00.000Z","dependencies_parsed_at":"2024-10-31T05:32:20.619Z","dependency_job_id":"eda83427-eb39-46c2-b32f-519e271444df","html_url":"https://github.com/doesdev/rage-route","commit_stats":{"total_commits":21,"total_committers":1,"mean_commits":21.0,"dds":0.0,"last_synced_commit":"3ae8cd1b4c3997890a11f8a80b2e8c8d6dcc28d8"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doesdev%2Frage-route","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doesdev%2Frage-route/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doesdev%2Frage-route/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doesdev%2Frage-route/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doesdev","download_url":"https://codeload.github.com/doesdev/rage-route/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225073864,"owners_count":17416696,"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":[],"created_at":"2024-08-01T13:01:55.185Z","updated_at":"2026-01-15T22:37:48.861Z","avatar_url":"https://github.com/doesdev.png","language":"JavaScript","readme":"# rage-route [![NPM version](https://badge.fury.io/js/rage-route.svg)](https://npmjs.org/package/rage-route)   [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)   \n\n\u003e Tiny, feature lite, super basic client router\n\n## Why rage?\n\nThis was built as a very feature light replacement for page.js.\n\nShips with es6 styled module and commonjs module for your rolling pleasure.\n\n## Install\n\n```sh\n$ npm install --save rage-route\n```\n\n## Usage\n\n```js\nimport { addRoute, addRedirect, route, history } from 'rage-route'\naddRoute('/somepage', 'Page Title', (state) =\u003e handlePageRoute(state))\naddRedirect('/someotherpage', '/somepage')\naddRoute('.*', 'Everything Else', (state) =\u003e handleDefaultRoute(state))\n...\nroute('/somepage')\n...\nconsole.log(history.previous)\nconsole.log(history.current)\n```\n\n## API\n\n#### Add route handler\n\n#### `addRoute(*path, *title, *callback)`\n\n- **path** *[string - required]* (ex. `'/somepage'`)\n- **title** *[string - required]* (ex. `'Page Title'`)\n- **callback** *[function - receives state object - required]* (ex. `(state) =\u003e fn(state)`)\n\n#### Add redirect from a new path to an existing path\n\n#### `addRedirect(*newPath, *existingPath)`\n\n- **newPath** *[string - required]* (ex. `'/someotherpage'`)\n- **existingPath** *[string - required]* (ex. `'/somepage'`)\n\n#### Route to another page, triggering callback set in addRoute\n\n#### `route(*path, *title, *state, *noStore)`\n\n- **path** *[string - required]* (ex. `'/somepage'`)\n- **title** *[string - optional]* (ex. `'Page Title'`)\n- **state** *[object - optional]* (ex. `{foo: 'bar'}`)\n- **noStore** *[boolean - optional - don't store state in history]* (ex. `true`)\n\n#### Get array of registered routes\n\n#### `list()`\n\n#### We also expose a history object with the previous and current page\n\n#### `history`\n\n- **previous** *[string]* previous page\n- **current** *[string]* current page\n\n## License\n\nMIT © [Andrew Carpenter](https://github.com/doesdev)\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoesdev%2Frage-route","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoesdev%2Frage-route","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoesdev%2Frage-route/lists"}