{"id":14977631,"url":"https://github.com/jmjuanes/rouct","last_synced_at":"2026-03-07T00:02:23.910Z","repository":{"id":57147140,"uuid":"127879140","full_name":"jmjuanes/rouct","owner":"jmjuanes","description":"Micro client-side routing component for React","archived":false,"fork":false,"pushed_at":"2023-08-11T19:46:51.000Z","size":123,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-14T14:45:45.441Z","etag":null,"topics":["micro-router","react","react-component","react-router","router"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/rouct","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/jmjuanes.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":"2018-04-03T08:51:34.000Z","updated_at":"2022-05-20T17:21:48.000Z","dependencies_parsed_at":"2024-09-18T22:06:27.965Z","dependency_job_id":null,"html_url":"https://github.com/jmjuanes/rouct","commit_stats":{"total_commits":215,"total_committers":2,"mean_commits":107.5,"dds":"0.0046511627906976605","last_synced_commit":"eaf2409e65cb2425ceb830a4ee1fa93124ea5889"},"previous_names":["siimple/neutrine-router"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/jmjuanes/rouct","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmjuanes%2Frouct","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmjuanes%2Frouct/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmjuanes%2Frouct/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmjuanes%2Frouct/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmjuanes","download_url":"https://codeload.github.com/jmjuanes/rouct/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmjuanes%2Frouct/sbom","scorecard":{"id":524530,"data":{"date":"2025-08-11","repo":{"name":"github.com/jmjuanes/rouct","commit":"eaf2409e65cb2425ceb830a4ee1fa93124ea5889"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/jmjuanes/rouct/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/jmjuanes/rouct/release.yml/main?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"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":"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":"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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/release.yml:1","Info: no jobLevel write permissions found"],"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":"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":"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":"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 'main'"],"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-20T03:59:57.910Z","repository_id":57147140,"created_at":"2025-08-20T03:59:57.910Z","updated_at":"2025-08-20T03:59:57.910Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30204110,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T19:07:06.838Z","status":"ssl_error","status_checked_at":"2026-03-06T18:57:34.882Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["micro-router","react","react-component","react-router","router"],"created_at":"2024-09-24T13:56:02.175Z","updated_at":"2026-03-07T00:02:23.895Z","avatar_url":"https://github.com/jmjuanes.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rouct\n\n\u003e Micro client-side routing component for React.\n\n[![npm](https://img.shields.io/npm/v/rouct.svg)](https://www.npmjs.com/package/rouct)\n[![npm](https://img.shields.io/npm/dt/rouct.svg)](https://www.npmjs.com/package/rouct)\n[![npm](https://img.shields.io/npm/l/rouct.svg)](https://github.com/jmjuanes/rouct)\n\n\n**Rouct** is a micro client-side routing component for building **single page applications** (SPA for short) with [React](https://www.reactjs.org). \n\n**Rouct** is based on the new **Context API** of [**React 16.3.0**](https://reactjs.org/docs/context.html), so this package only works with versions of React higher than `16.3.0`.\n\n## Installation \n\nUse **npm** or **yarn** to install the package:\n\n```bash\n## Install using NPM:\n$ npm install --save rouct\n\n## Install using YARN:\n$ yarn add rouct\n```\n\nYou can now import `rouct` in your ES6 module:\n\n```javascript\nimport Rouct from \"rouct\";\n```\n\n## Example\n\nThere is an example of a simple website using `rouct` with the **hashbang** routing strategy.\n\n```jsx\nimport React from \"react\";\nimport Rouct from \"rouct\";\n\n// Main component\nclass App extends React.Component {\n    render() {\n        return (\n            \u003cul\u003e\n                \u003cli onClick={() =\u003e Rouct.redirect(\"/\"); }\u003eHome\u003c/li\u003e\n                \u003cli onClick={() =\u003e Rouct.redirect(\"/products\"); }\u003eProducts\u003c/li\u003e\n                \u003cli onClick={() =\u003e Rouct.redirect(\"/about\"); }\u003eAbout\u003c/li\u003e\n            \u003c/ul\u003e\n            \u003chr/\u003e\n            \u003cRouct.Router routing={Rouct.HashbangRouting}\u003e\n                \u003cRouct.Switch\u003e\n                    \u003cRouct.Route exact path=\"/\" component={HomePage}/\u003e\n                    \u003cRouct.Route path=\"/products\" component={ProductsPage}/\u003e\n                    \u003cRouct.Route exact path=\"/about\" component={AboutPage}/\u003e\n                    \u003cRouct.Route path=\"*\" component={NotFound}/\u003e\n                \u003c/Rouct.Switch\u003e\n            \u003c/Rouct.Router\u003e\n        );\n    }\n}\n\n// The HomePage component will be rendered when the user navigates to the root ('/' or '#!/')\nclass HomePage extends React.Component {\n    render() {\n        return (\n            \u003ch2\u003eWelcome\u003c/h2\u003e\n            \u003cdiv\u003eWelcome to our page\u003c/div\u003e\n        );\n    }\n}\n\n// The Products page will be rendered when the user navigates to '#!/products'. \n// This component will also catch any path that starts with '#!/products' \n// (note that the 'exact' attribute is not used in the products route of the App component).\nclass ProductsPage extends React.Component {\n    render() {\n        return (\n            \u003ch2\u003eProducts\u003c/h2\u003e\n            \u003cul\u003e\n                \u003cli onClick={() =\u003e Rouct.redirect(\"/products/product1\"); }\u003eProduct 1\u003c/li\u003e\n                \u003cli onClick={() =\u003e Rouct.redirect(\"/products/product2\"); }\u003eProduct 2\u003c/li\u003e\n            \u003c/ul\u003e\n            \u003cRouct.Route exact path=\"/products\" component={EmptyProductPage}/\u003e\n            \u003cRouct.Route exact path=\"/products/:product\" component={DetailProductPage}/\u003e\n        );\n    } \n}\n\nclass DetailProductPage extends React.Component {\n    render() {\n        let product = this.props.request.params.product;\n        return (\n            \u003ch5\u003e{product}\u003c/h5\u003e\n            \u003cdiv\u003eHere goes the product description\u003c/div\u003e\n        );\n    }\n}\n\nclass EmptyProductPage extends React.Component {\n    render() {\n        return \u003cdiv\u003ePlease select a product from the list\u003c/div\u003e;\n    }\n}\n\n//The AboutPage component will be rendered when the user navigates to '#!/about'\nclass AboutPage extends React.Component {\n    render() {\n        return \u003ch2\u003eAbout\u003c/h2\u003e;\n    }\n}\n\n// The NotFound component will be rendered when the user navigates to another url not listed above\nclass NotFound extends React.Component {\n    render() {\n        return \u003ch2\u003eNot found\u003c/h2\u003e;\n    }\n}\n```\n\n## API \n\n### Rouct.Router\n\nThe base routing component. You should only use one `\u003cRouct.Router\u003e` component in your application.\n\nThis component accepts the following props:\n\n- `rouging`: one of the routing methods provided by Rouct (`Rouct.HashbangRouting` or `Rouct.BrowserRouting`). The router component will save the selected method and use it for the redirect function.\n- `pathPrefix`: a prefix added to all paths on the site. Default is `/`.\n\n```jsx\n\u003cRouct.Router routing={Rouct.BrowserRouting}\u003e\n    \u003cRouct.Route path=\"/\" component={Home}/\u003e\n\u003c/Rouct.Router\u003e\n```\n\n### Rouct.Switch\n\nA component that renders the first child `Rouct.Route` that matches the current location. \n\n```jsx\n\u003cRouct.Switch\u003e\n    \u003cRouct.Route exact path=\"/\" component={HomePage}/\u003e\n    \u003cRouct.Route path=\"/services\" component={ServicesPage}/\u003e\n    \u003cRouct.Route exact path=\"/about\" component={AboutPage}/\u003e\n    \u003cRouct.Route path=\"*\" component={NotFound}/\u003e\n\u003c/Rouct.Switch\u003e\n```\n\nThis component accepts a `reset` prop (added in `v0.3.0`): if `true`, the matched route will be rendered again when path changes (default set to `false`).\n\n\n### Rouct.Route\n\nA React component that is used to assign a path to a component that should be rendered if the current path matches the route path.\n\n```jsx\n\u003cRouct.Route exact path=\"/\" component={HomePage}/\u003e\n\u003cRouct.Route exact path=\"/about\" component={AboutPage}/\u003e\n\u003cRouct.Route exact path=\"/portfolio\" component={PortfolioPage}/\u003e\n```\n\nThe `Rouct.Route` component expects the following props:\n\n##### `path`\n\nA `string` that describes the pathname that the route matches. When the current location matches the route's path, the component specified by the `component` prop is rendered.\n\n```jsx\n\u003cRouct.Route path=\"/about/contact\" component={ContactPage}/\u003e\n```\n\nThe `path` can also be a dynamic path string, using named parameters prefixed by a colon to the parameter name. For example, the path `/user/:name` matches `/user/bob` and `user/susan`. The captured values are stored in the `request.params` object passed as a property to the rendered component.\n\n```jsx\n\u003cRouct.Route path=\"/user/:name\" component={UserManagement}/\u003e\n```\n\nYou can also create a catch-all route setting the `path` value to `*`:\n\n```jsx\n\u003cRouct.Route path=\"*\" component={NotFoundPage}/\u003e\n``` \n\n\u003e **Important note**: query strings are not part of the route path.\n \n\n##### `component`\n\nA React component that should be rendered when the route matches. This component will be called with the props passed from the `props` property of the Route. Also, a `request` object will be passed as a prop with the following entries: \n\n- `path`: a `string` with the full matched path.\n- `pathname`: a `string` with the part of the URL before the start of the `query`.\n- `query`: an `object` that contains all query-string parameters in the matched path. Default is an empty object `{}`.\n- `params`: an `object` that contains all parsed properties extracted from the dynamic parts of the path. Default is an empty object `{}`.\n\n##### `props`\n\n**Optionally** An `object` with the extra props that should be passed to the rendered `component` when the route matches.\n\n```jsx\nlet homeProps = {\n    title: \"Hello world!\"\n};\n\u003cRouct.Route path=\"/\" component={HomePage} props={homeProps}/\u003e\n```\n\n##### `render`\n\nA function that will be called when the route matches. This prop can not be uswd with the `component` property.\n\n```jsx\n\u003cRouct.Route path=\"/\" render={function () {\n    return \"Hello world\";\n}} /\u003e\n```\n\n\n##### `exact`\n\n**Optionally** A `boolean` used to ensure that the route's path is an exact match of the current location. Default is `false`.\n\n| Router's path | Current path | Is Exact active? | Matches? |\n|---------------|--------------|------------------|----------|\n| `/`           | `/one/two`   | Yes              | No       |\n| `/`           | `/one/two`   | No               | Yes      | \n| `/one`        | `/one/two`   | Yes              | No       |\n| `/one/`       | `/one/two`   | No               | Yes      |\n| `/one/two`    | `/one/two`   | Yes              | Yes      |\n| `/one/two`    | `/one/two`   | No               | Yes      |\n\n\n### Rouct.recirect(url)\n\nUse this function to change the URL with the provided path. This function uses the routing method provided in the `\u003cRouct.Router\u003e` component.\n\n```jsx\nclass Menu extends React.Component {\n    render() {\n        return (\n            \u003cdiv className=\"menu\"\u003e\n                \u003ca onClick={() =\u003e Rouct.redirect(\"/\");}\u003eHome\u003c/a\u003e\n                \u003ca onClick={() =\u003e Rouct.redirect(\"/about\");}\u003eAbout\u003c/a\u003e\n                \u003ca onClick={() =\u003e Rouct.redirect(\"/portfolio\");}\u003ePortfolio\u003c/a\u003e\n            \u003c/div\u003e\n        );\n    }\n}\n```\n\n\n### Rouct.BrowserRouting\n\nThe **browser history** routing strategy is based on the HTML5 history API (`history.pushState` and `popstate` event listener). \n\n```jsx\nclass App extends React.Component {\n    render() {\n        return (\n            \u003cRouct.Router routing={Rouct.BrowserRouting}\u003e \n                {/* Place here your children components */}\n            \u003c/Rouct.Router\u003e\n        );\n    }\n}\n```\n\n### Rouct.HashbangRouting\n\nThe **hashbang** routing strategy adds an exclamation mark after the hash to indicate that the hash is used for routing. A tipically url with a *hashbang* looks like: \n\n```\nhttp://example.com/#!/about/contact\n```\n\nUsing this strategy is guaranteed to work in browsers that do not support `history.pushState` (of course, IE9 and older versions).\n\n\n\n## License\n\nReleased under the [MIT LICENSE](./LICENSE).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmjuanes%2Frouct","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmjuanes%2Frouct","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmjuanes%2Frouct/lists"}