{"id":23197256,"url":"https://github.com/jsnjack/amy.js","last_synced_at":"2025-04-05T08:43:50.877Z","repository":{"id":26628206,"uuid":"30083829","full_name":"jsnjack/amy.js","owner":"jsnjack","description":"JavaScript routing library","archived":false,"fork":false,"pushed_at":"2015-02-08T19:12:53.000Z","size":204,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-17T18:52:15.965Z","etag":null,"topics":[],"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/jsnjack.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":"2015-01-30T17:51:24.000Z","updated_at":"2015-02-08T19:11:37.000Z","dependencies_parsed_at":"2022-09-22T16:42:08.770Z","dependency_job_id":null,"html_url":"https://github.com/jsnjack/amy.js","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsnjack%2Famy.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsnjack%2Famy.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsnjack%2Famy.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsnjack%2Famy.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsnjack","download_url":"https://codeload.github.com/jsnjack/amy.js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312066,"owners_count":20918341,"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-12-18T14:29:32.395Z","updated_at":"2025-04-05T08:43:50.532Z","avatar_url":"https://github.com/jsnjack.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/e-shulitsky/amy.js.svg)](https://travis-ci.org/e-shulitsky/amy.js)\n[![Test Coverage](https://codeclimate.com/github/e-shulitsky/amy.js/badges/coverage.svg)](https://codeclimate.com/github/e-shulitsky/amy.js)\namy.js\n============\n###What is it\namy.js is a JavaScript routing library\n\n###How to install\namy.js is designed to use in browser. Just add it somewhere in your html file:\n```html\n\u003cscript src=\"amy.js\" type=\"text/javascript\"\u003e\u003c/script\u003e\n```\n\n###How to use\n+ Start by adding routes:\n```javascript\n(function () {\n    Amy.add(\"/\", function (params) {\n        some_function();\n    });\n})();\n```\n+ You can also use capturing groups:\n```javascript\nAmy.add(\"/:id/#:type/\", function (params) {\n    ...\n});\n```\n+ `params` is the object, that contains capturing groups and query parameters. For the route from section 2 and link `/12/#week/?date=today` `params` object will look something like:\n```javascript\nparams = {\n    location: \"/12/#week/?date=today\",\n    id: 12,\n    type: \"week\",\n    date: \"today\"\n}\n```\n+ Set up what happens when location is not found in routes:\n```javascript\nAmy.not_found = function (location) {\n    do_something();\n}\n```\n+ When you finished with configuration, call init() method:\n```javascript\nAmy.init();\n```\n+ To manually run routes check:\n```javascript\nAmy.run_route(\"/new/location/\");\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsnjack%2Famy.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsnjack%2Famy.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsnjack%2Famy.js/lists"}