{"id":13793355,"url":"https://github.com/mrozbarry/hyperapp-router","last_synced_at":"2025-03-21T13:31:42.352Z","repository":{"id":43979516,"uuid":"246168542","full_name":"mrozbarry/hyperapp-router","owner":"mrozbarry","description":"A modern router for hyperapp","archived":false,"fork":false,"pushed_at":"2024-04-05T03:18:52.000Z","size":853,"stargazers_count":21,"open_issues_count":7,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T01:51:19.914Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://hyperapp-hn.surge.sh/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrozbarry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-03-10T00:06:51.000Z","updated_at":"2024-02-23T08:12:03.000Z","dependencies_parsed_at":"2024-06-19T02:46:17.282Z","dependency_job_id":"f1f5b028-f892-4e32-a3a2-d7e347ed995c","html_url":"https://github.com/mrozbarry/hyperapp-router","commit_stats":{"total_commits":29,"total_committers":5,"mean_commits":5.8,"dds":0.4137931034482759,"last_synced_commit":"390108dc568e4d11d9311ab2ff6ba19a726f79d4"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrozbarry%2Fhyperapp-router","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrozbarry%2Fhyperapp-router/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrozbarry%2Fhyperapp-router/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrozbarry%2Fhyperapp-router/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrozbarry","download_url":"https://codeload.github.com/mrozbarry/hyperapp-router/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244806112,"owners_count":20513382,"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-03T23:00:19.411Z","updated_at":"2025-03-21T13:31:42.002Z","avatar_url":"https://github.com/mrozbarry.png","language":"JavaScript","funding_links":[],"categories":["Utilities"],"sub_categories":[],"readme":"# Hyperapp Router\n\n[![npm (scoped)](https://img.shields.io/npm/v/@mrbarrysoftware/hyperapp-router?style=flat-square)](https://www.npmjs.com/package/@mrbarrysoftware/hyperapp-router)\n\n\u003e **Warning**\nThis is a beta release, and the API will be completely unstable.\nExpect any change to be breaking until a proper API is ironed out.\n\n## Install\n\n```bash\nnpm install --save @mrbarrysoftware/hyperapp-router\n# or\nyarn add @mrbarrysoftware/hyperapp-router\n```\n\n## Usage\n\n```js\nimport { app, h, text } from 'hyperapp';\nimport withRouter, { effects } from '@mrbarrysoftware/hyperapp-router';\n\nconst GoToHref = (state, { href }) =\u003e [\n  state,\n  effects.Navigate({ href }), // where href is a string, like `/route/path/here`\n];\n\nwithRouter(app)({\n  router: {\n    // Optional base url for the app.\n    // Use this if your app runs from anywhere that\n    // isn't at the root of the server.\n    // Defaults to '/'\n    baseUrl: '/foo',\n\n    // Optional action ran every push/pop state\n    // Useful when you just need navigation to\n    // set something in state\n    RouteAction: (state, { params, path }) =\u003e ({\n      ...state,\n    }),\n\n    // Optional boolean\n    // Prevents the router from capturing every\n    // click on an anchor and attempting to route\n    // it. Removing this means you will need to\n    // add custom actions and effects to allow\n    // navigation with the router.\n    // If not set, the default is false, and that's\n    // probably what you want.\n    disableAnchorCapture: false,\n    \n    routes: {\n      '/': {\n        // Optional Action to run when entering this route\n        OnEnter: (state, params) =\u003e ({\n          ...state,\n        }),\n\n        // Optional Action to run when leaving this route\n        OnLeave: (state, params) =\u003e ({\n          ...state,\n        }),\n      },\n    },\n  },\n\n  init: {},\n\n  view: state =\u003e {\n    return h('div', null, text('Your app here...'));\n  },\n\n  node: document.querySelector('#app'),\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrozbarry%2Fhyperapp-router","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrozbarry%2Fhyperapp-router","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrozbarry%2Fhyperapp-router/lists"}