{"id":18429417,"url":"https://github.com/bigpipe/routable","last_synced_at":"2025-09-09T07:39:32.574Z","repository":{"id":4690460,"uuid":"5837332","full_name":"bigpipe/routable","owner":"bigpipe","description":"Route matching and testing, nothing more than that. As simple as it could and should be.","archived":false,"fork":false,"pushed_at":"2016-11-16T20:45:51.000Z","size":45,"stargazers_count":5,"open_issues_count":1,"forks_count":3,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-22T21:51:13.745Z","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/bigpipe.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":"2012-09-17T06:55:20.000Z","updated_at":"2016-07-19T11:57:04.000Z","dependencies_parsed_at":"2022-09-02T14:31:43.170Z","dependency_job_id":null,"html_url":"https://github.com/bigpipe/routable","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigpipe%2Froutable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigpipe%2Froutable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigpipe%2Froutable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigpipe%2Froutable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bigpipe","download_url":"https://codeload.github.com/bigpipe/routable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247697989,"owners_count":20981282,"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-06T05:17:09.784Z","updated_at":"2025-04-07T17:33:03.657Z","avatar_url":"https://github.com/bigpipe.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Routable\n\n[![Build Status](https://travis-ci.org/bigpipe/routable.png)](https://travis-ci.org/bigpipe/routable)\n\nRoutable is a lightweight regular expression inspired HTTP route parser for\nNode.js. It only has one goal and that is to match and parse URL's for\nframeworks.\n\n### Installation\n\nThe module is released in the `npm` registry as `routable`:\n\n```\nnpm install --save routable\n```\n\nThe `--save` automatically adds the routable module to your package.json.\n\n### Getting started\n\nAll the examples in this getting started assume that you have included the\nmodule in your code and exposed it as a `Routable` variable:\n\n```js\n'use strict';\n\nvar Routable = require('routable');\n```\n\nTo create a new route simply construct a new `Routable` instance with an URL\npattern:\n\n```js\nvar foo = new Routable('/foo');\n```\n\nThere are different patterns that can be used for testing against URL's.\nRoutable supports testing against strings, Regular Expressions and even xRegExp\nbased expressions. See [patterns](#patterns) for more details.\n\nNow that you've created your first `Routable` instance you can use it to test\nagainst URL's. To see if a URL matches the your `Routable` instance you can use\nthe `Routable#test` method:\n\n#### Routable.test(url)\n\nJust like the `RegularExpression.test` method, it returns a boolean indicating\nif the given string matches the expression or not. The same is true for\n`Routable` but instead of testing a Regular Express you're testing your pattern.\n\n```js\nvar foo = new Routable('/foo');\n\nfoo.test('/bar');   // false;\nfoo.test('/foo');   // true;\nfoo.test('/fooo');  // false;\n```\n\nWhile quickly testing an URL is useful sometimes you also want to parse out the\ninformation from the URL. If you have a capturing or named Regular Expression or\nstring you can use the `routable#exec`\n\n#### Routable.exec(url)\n\nWith normal `RegularExpression.exec` you can either `undefined` or an `Array`\nwith results as return value. With a `Routable` instance you still get\n`undefined` when there isn't a match but instead of an array you receive an\n`Object`.\n\n```js\nvar foobar = new Routable('/foo/:bar');\n\nvar res = foobar.exec('/foo/foo');\n\nconsole.log(res.bar); // 'foo'\n```\n\n### Patterns\n\n- Regular Expressions `/\\/foo/`.\n- Capturing Regular Expressions `/\\/(foo|bar)\\/bar/`.\n- Capturing strings `/foo/:bar/1/:baz`.\n- Optional parameters `/foo/:bar?`.\n- Plain strings `/foo/bar`\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigpipe%2Froutable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbigpipe%2Froutable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigpipe%2Froutable/lists"}