{"id":25470073,"url":"https://github.com/thinkphp/router","last_synced_at":"2025-11-04T18:30:28.191Z","repository":{"id":3412971,"uuid":"4463603","full_name":"thinkphp/router","owner":"thinkphp","description":"Standalone JS Routing","archived":false,"fork":false,"pushed_at":"2012-05-28T13:14:09.000Z","size":104,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-14T14:54:28.837Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://thinkphp.ro/apps/js-hacks/router/","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/thinkphp.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":"2012-05-27T18:00:11.000Z","updated_at":"2014-05-04T08:41:53.000Z","dependencies_parsed_at":"2022-09-02T08:15:31.846Z","dependency_job_id":null,"html_url":"https://github.com/thinkphp/router","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2Frouter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2Frouter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2Frouter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2Frouter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thinkphp","download_url":"https://codeload.github.com/thinkphp/router/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239437137,"owners_count":19638441,"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-02-18T08:31:50.900Z","updated_at":"2025-11-04T18:30:28.126Z","avatar_url":"https://github.com/thinkphp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Router\n------\n\nA basic routes framework for JS using hashchange event.\n\nSynopsis\n========\n\n      var app = new Router()\n  \n          app.get('/pages/:n', function( data ){\n\n                 //do something with data\n                 console.log( data.n )\n          })\n\n          app.run() \n\nHow to use\n==========\n\n       var app = new Router()\n\n           app.get('/bubble', function() {                     \n\n                  var arr = [9,8,7,6,5,4,3,2,1,0], \n                      n = arr.length,\n                      swap = function(i,j) {var aux = arr[i]; arr[i] = arr[j]; arr[j] = aux;}\n\n                  console.log(arr);\n\n                  for(var i=0;i\u003cn-1;i++) {\n                      for(var j=i+1;j\u003cn;j++) {\n                          if(arr[i]\u003earr[j]) {\n                             swap(i,j)\n                          }\n                      }\n                  }\n\n                  console.log( 'bubble sort' )\n                  console.log(arr);\n           }) \n\n           app.get('/insert', function() {\n\n                  var arr = [9,8,7,6,5,4,3,2,1,0], \n                      n = arr.length\n\n                  console.log( arr )\n\n                  for(var i=1;i\u003cn;i++) {\n\n                      var temp = arr[i],\n                          j = i - 1  \n\n                          while(j\u003e=0 \u0026\u0026 temp \u003c arr[j]) {\n                                arr[j+1] = arr[j]\n                                j--\n                          } \n                          arr[j+1] = temp \n                  }\n\n                  console.log( 'insert sort' )\n                  console.log( arr )\n                   \n           }) \n\n\n\n           app.get('/subsets/:n', function( data ) {\n\n                   var n = parseInt( data.n ), \n                       arr = [], \n                       out = \"\"\n\n                   for(var i=0;i\u003cn;i++) {\n                       arr[i] = 0\n                   }  \n\n                   do {\n                      arr[n-1]++\n                                    \n                      for(var j=n-1;j\u003e=0;j--) {  \n\n                          if(arr[j] \u003e 1) {\n                             arr[j] -= 2\n                             arr[j-1] += 1\n                          } \n                      }\n\n\n                      for(var j=0;j\u003cn;j++) {  \n\n                          if(arr[j]) out += (j+1) + ', ' \n                      }\n\n                      out += '\\n'\n \n                      var s = 0   \n                      for(var k = n - 1; k \u003e= 0; k--) {  \n                          s = s + parseInt(arr[k])  \n                      }\n\n                   }while(s \u003c n)\n\n                   console.log( out ) \n           }) \n\n           app.get('/services/:denumire', function( data ){\n\n                    console.log(data.denumire)\n           })\n\n           app.run()\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkphp%2Frouter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinkphp%2Frouter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkphp%2Frouter/lists"}