{"id":28471799,"url":"https://github.com/peburrows/router.js","last_synced_at":"2025-07-01T22:30:58.738Z","repository":{"id":66505426,"uuid":"1761785","full_name":"peburrows/router.js","owner":"peburrows","description":"javascript router for single-page apps","archived":false,"fork":false,"pushed_at":"2012-05-18T20:57:16.000Z","size":87,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-07T11:08:50.029Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/peburrows.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}},"created_at":"2011-05-17T17:13:08.000Z","updated_at":"2021-08-25T00:48:30.000Z","dependencies_parsed_at":"2023-02-20T05:31:02.416Z","dependency_job_id":null,"html_url":"https://github.com/peburrows/router.js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/peburrows/router.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peburrows%2Frouter.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peburrows%2Frouter.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peburrows%2Frouter.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peburrows%2Frouter.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peburrows","download_url":"https://codeload.github.com/peburrows/router.js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peburrows%2Frouter.js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263046071,"owners_count":23405127,"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":"2025-06-07T11:08:55.814Z","updated_at":"2025-07-01T22:30:58.711Z","avatar_url":"https://github.com/peburrows.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Usage\n\n```javascript\n    // create a router\n    var router = new Router();\n\n    // define routes\n    router.define('/hello/world', function(){\n      // `this` refers to the request inside of the handler\n      if(this.method == 'GET'){ alert('hello, world'); }\n      else                    { alert('hello, world via ' + this.method); }\n    }).resources('users', {\n      show    : function(){\n        $.get(this.path, this.queryParams, function(data) {\n          $('#wrapper').html(data);\n        });\n      },\n      index   : function(){\n        // load users...\n      },\n      edit    : function(){\n        // load the edit user form\n      }\n    }).catchAll(function(){\n      // all requests that do not match route will be passed to this handler\n    }).default(function(){\n      // the default route to push on initial page load\n    });\n```\n\n## Requirements\n\nCurrently requires [jQuery](https://github.com/jquery/jquery), [jquery.url.js](https://github.com/peburrows/jQuery-URL-Parser), and [jquery.ba-bbq.js](https://github.com/cowboy/jquery-bbq), although I'll soon be working to eliminate those dependencies","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeburrows%2Frouter.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeburrows%2Frouter.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeburrows%2Frouter.js/lists"}