{"id":18256173,"url":"https://github.com/serapath/route-stream","last_synced_at":"2025-04-08T22:27:00.166Z","repository":{"id":66204133,"uuid":"74471994","full_name":"serapath/route-stream","owner":"serapath","description":"router to stream routes","archived":false,"fork":false,"pushed_at":"2016-11-22T13:01:40.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-03-25T03:03:13.123Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/route-stream","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/serapath.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":"2016-11-22T12:50:19.000Z","updated_at":"2016-11-22T13:03:49.000Z","dependencies_parsed_at":"2023-06-09T20:30:19.686Z","dependency_job_id":null,"html_url":"https://github.com/serapath/route-stream","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"74b82b625c78dddc407da1f08103ce0febe67046"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serapath%2Froute-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serapath%2Froute-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serapath%2Froute-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serapath%2Froute-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serapath","download_url":"https://codeload.github.com/serapath/route-stream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247937256,"owners_count":21021219,"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-11-05T10:20:17.756Z","updated_at":"2025-04-08T22:27:00.147Z","avatar_url":"https://github.com/serapath.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# route-stream\nrouter to stream routes\n\n# usage\n`npm install route-stream`\n\n```js\nvar router = require('route-stream')\n\n// prepare some router handlers\nfunction home ({ from, to, data }) {\n  return `\u003cdiv\u003ehome:\"${from}\"=\u003e\"${to}\",${JSON.stringify(data)}\u003c/div\u003e`\n}\nfunction products ({ from, to, data }) {\n  return `\u003cdiv\u003eproducts:\"${from}\"=\u003e\"${to}\",${JSON.stringify(data)}\u003c/div\u003e`\n}\nfunction _404 ({ from, to, data }) {\n  return `\u003cdiv\u003e404:\"${from}\"=\u003e\"${to}\",${JSON.stringify(data)}\u003c/div\u003e`\n}\n\n// use\nvar routes = router({ '/': home, '/products': products, 404: _404 })\n// OR\nvar routes = router()\nroutes(404, _404) // 404 route is optional - router has a default 404 route\nroutes('/', home)\nroutes('/products', products)\nroutes('/products', undefined) // remove route '/products'\n\nconsole.log(routes instanceof router) // =\u003e true\n\n// test\nroutes.on('data', function parent (route) { console.log(route) })\n\n// NAVIGATE\nroutes.write({ to: '/' })\nroutes.write({ to: '/doesntexist', data: { x: 1 } })\nroutes.write({ to: '/products', data: { x: 1 } })\nroutes.write({ to: '/' })\nroutes.write({ to: '/', data: { foo: 'bar' }})\nroutes.write({ data: { foo: 'only data' }})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserapath%2Froute-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserapath%2Froute-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserapath%2Froute-stream/lists"}