{"id":19357234,"url":"https://github.com/aknuds1/choo-routehandler","last_synced_at":"2026-06-08T20:32:32.446Z","repository":{"id":57105379,"uuid":"80616008","full_name":"aknuds1/choo-routehandler","owner":"aknuds1","description":"A minimal WIP route handling framework on top of choo","archived":false,"fork":false,"pushed_at":"2020-05-21T22:10:07.000Z","size":22,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-11T02:40:04.840Z","etag":null,"topics":["choo","framework","javascript","routing"],"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/aknuds1.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":"2017-02-01T12:00:35.000Z","updated_at":"2018-12-24T08:35:49.000Z","dependencies_parsed_at":"2022-08-20T23:50:09.187Z","dependency_job_id":null,"html_url":"https://github.com/aknuds1/choo-routehandler","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/aknuds1/choo-routehandler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aknuds1%2Fchoo-routehandler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aknuds1%2Fchoo-routehandler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aknuds1%2Fchoo-routehandler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aknuds1%2Fchoo-routehandler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aknuds1","download_url":"https://codeload.github.com/aknuds1/choo-routehandler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aknuds1%2Fchoo-routehandler/sbom","scorecard":{"id":176383,"data":{"date":"2025-08-11","repo":{"name":"github.com/aknuds1/choo-routehandler","commit":"e197d419fa2f3196c6514d82b3abaeb38a43488a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-16T17:45:47.430Z","repository_id":57105379,"created_at":"2025-08-16T17:45:47.430Z","updated_at":"2025-08-16T17:45:47.430Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34080027,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["choo","framework","javascript","routing"],"created_at":"2024-11-10T07:06:45.100Z","updated_at":"2026-06-08T20:32:32.431Z","avatar_url":"https://github.com/aknuds1.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# choo-routehandler\nThis is a small route handling framework on top of [Choo](https://github.com/yoshuawuyts/choo).\nBeware it's a work in progress and likely to change!!\n\nThe core feature of this framework is that it provides a function for wrapping your route handlers,\nmitigating the need for writing boilerplate code. It requires three arguments: `view`, `loader`\nand `layout`. You can also pass an options object as the fourth argument.\n\n\u003cdl\u003e\n  \u003cdt\u003eview\u003c/dt\u003e\n  \u003cdd\u003eEither a function, for rendering the view corresponding to the route, or a module containing\n  at least a function \u003ccode\u003erender\u003c/code\u003e fulfilling the aforementioned responsibility, optionally\n  a function \u003ccode\u003eloadData\u003c/code\u003e for loading data pertaining to the route before rendering it and\n  optionally a function or attribute \u003ccode\u003epageTitle\u003c/code\u003e for defining a route's page title.\n  The loadData function should return a promise resolving to an object to patch Choo state with.\u003c/dd\u003e\n\n  \u003cdt\u003eloader\u003c/dt\u003e\n  \u003cdd\u003eAn argument free function that should return a DOM element representing a loading screen.\u003c/dd\u003e\n\n  \u003cdt\u003elayout\u003c/dt\u003e\n  \u003cdd\u003eA function representing the layout of the view, that should take four arguments, the rendered\n  view, \u003ccode\u003estate\u003c/code\u003e, \u003ccode\u003eprev\u003c/code\u003e and \u003ccode\u003esend\u003c/code\u003e, and return a DOM element.\u003c/dd\u003e\n\n  \u003cdt\u003eopts\u003c/dt\u003e\n  \u003cdd\u003eAn object providing options to the route handler. The following options are supported:\n  \u003cul\u003e\n    \u003cli\u003erequiresLogin: Configure whether the route requires the user to be logged in.\u003c/li\u003e\n    \u003cli\u003eisUserLoggedIn: A function taking \u003ccode\u003estate\u003c/code\u003e as its argument, returning whether\n    the user is logged in or not.\u003c/li\u003e\n    \u003cli\u003eloginUrl: The URL to redirect to if the route requires login and user hasn't yet been\n    logged in.\u003c/li\u003e\n  \u003c/ul\u003e\n  \u003c/dd\u003e\n\u003c/dl\u003e\n\n## Route Rendering\n\nThe route handler wrapper renders the view for your route inside a container element,\n`#route-container`, possessing an attribute called `data-route`, which encodes the current route\nand query string. It also registers a callback via a\n[MutationObserver](https://developer.mozilla.org/en/docs/Web/API/MutationObserver) that triggers\nwhen said attribute changes, in order to react as the rendered route changes. The reaction is\nimplemented as a Choo effect `handleRouteLoadedIntoDom`, which gets defined in the _model_ part\nof the framework.\n\nThe behaviour of the route handler is to, once it detects that the currently rendered route changes\n(including its query string), go through a standard procedure in order to render the corresponding\nview, depending on whether or not there is a data loading hook for the route:\n\n### With a Data Loading Hook\n1. Invoke the `loadData` hook and render the loading view.\n2. Once the `loadData` promise resolves, merge the resulting state subgraph into the Choo state\ngraph. Then call the `render` hook in order to render the view corresponding to the route.\n\n### Without a Data Loading Hook\nJust render the view corresponding to the route.\n\n## The Model\nThe model, defined in the model.js file of the package (import as e.g.\n`require('@arve.knudsen/choo-routehandler/model')`), defines state/effects/reducers required\nby the framework.\n\n## Example\n```\nconst routeHandler = require('@arve.knudsen/choo-routehandler')\nconst routeHandlerModel = require('@arve.knudsen/choo-routehandler/model')\nconst app = require('choo')\n\nconst loading = require('./loading')\nconst layout = require('./layout')\n\napp.model({\n  state: {...}\n})\nrouteHandlerModel(app)\n\napp.router({default: '/404',}, [\n  ['/404', routeHandler(notFoundView, loading, layout),],\n  ['/', routeHandler(mainView, loading, layout),],\n])\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faknuds1%2Fchoo-routehandler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faknuds1%2Fchoo-routehandler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faknuds1%2Fchoo-routehandler/lists"}