{"id":15625748,"url":"https://github.com/daniel15/routejs","last_synced_at":"2025-04-15T22:51:52.535Z","repository":{"id":8526264,"uuid":"10142516","full_name":"Daniel15/RouteJs","owner":"Daniel15","description":"JavaScript URL routing for ASP.NET MVC and WebForms","archived":false,"fork":false,"pushed_at":"2020-12-07T10:39:54.000Z","size":3116,"stargazers_count":84,"open_issues_count":9,"forks_count":17,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-03-29T02:12:26.875Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","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/Daniel15.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":"2013-05-18T14:40:44.000Z","updated_at":"2025-03-21T00:51:40.000Z","dependencies_parsed_at":"2022-09-07T07:42:01.462Z","dependency_job_id":null,"html_url":"https://github.com/Daniel15/RouteJs","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daniel15%2FRouteJs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daniel15%2FRouteJs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daniel15%2FRouteJs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daniel15%2FRouteJs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Daniel15","download_url":"https://codeload.github.com/Daniel15/RouteJs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249167436,"owners_count":21223505,"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-10-03T10:02:45.478Z","updated_at":"2025-04-15T22:51:52.518Z","avatar_url":"https://github.com/Daniel15.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"RouteJs\n=======\nRouteJs allows you to use your ASP.NET MVC or WebForms routes from JavaScript. It does not depend on\njQuery or any other JavaScript framework, so can be used in any scenario. RouteJs works with your\nexisting MVC routes, you do not need to use a different routing syntax or modify any of your \nexisting routes at all.\n\nBug reports and feature requests are welcome!\n\n[![Build status](https://img.shields.io/appveyor/ci/Daniel15/RouteJs/master.svg)](https://ci.appveyor.com/project/Daniel15/routejs/branch/master)\u0026nbsp;\n[![NuGet downloads](http://img.shields.io/nuget/dt/RouteJs.Mvc4.svg)](https://www.nuget.org/packages/RouteJs.Mvc4/)\u0026nbsp;\n[![NuGet version](http://img.shields.io/nuget/v/RouteJs.Mvc4.svg)](https://www.nuget.org/packages/RouteJs.Mvc4/)\u0026nbsp;\n\nRequirements\n============\nRequired:\n\n * ASP.NET 4.0 or higher\n * [Json.NET](http://james.newtonking.com/projects/json-net.aspx)\n * Any version of ASP.NET MVC from 2 onwards, including ASP.NET Core\n\nInstallation\n============\n\nFor ASP.NET MVC 5 and older\n---------------------------\n```\nInstall-Package RouteJs.Mvc4\n```\n(replace `RouteJs.Mvc4` with `RouteJs.Mvc3` for ASP.NET MVC 3 or `RouteJs.Mvc2` for ASP.NET MVC 2)\n\nAlternatively, you can get the latest development build from the\n[build server](http://teamcity.codebetter.com/viewType.html?buildTypeId=routejs\u0026guest=1).\n\nOnce installed, you need to reference the RouteJs handler in your view. This serves the JavaScript\nand route information:\n```html\n\u003cscript src=\"@RouteJs.RouteJsHandler.HandlerUrl\"\u003e\u003c/script\u003e\n```\n\nFor ASP.NET Core and ASP.NET Core MVC\n-------------------------------------\n\n```\nInstall-Package RouteJs.AspNet\n```\nOnce installed, you need to add RouteJs to your `Startup.cs` file, and also ensure `IActionContextAccessor` is registered:\n\n```csharp\nusing Microsoft.AspNetCore.Mvc.Infrastructure;\nusing RouteJs;\n...\nservices.AddSingleton\u003cIActionContextAccessor, ActionContextAccessor\u003e();\nservices.AddRouteJs();\n```\n\nThe RouteJs handler also needs to be referenced in your view (generally `_Layout.cshtml` is a \ngood place for this). This serves the JavaScript and route information:\n\n```csharp\n@inject RouteJs.IRouteJsHelper RouteJs\n@RouteJs.Render()\n```\n\nUsage\n=====\n\nThe main function is `Router.action`. This accepts three parameters:\n- Name of the controller\n- Name of the action\n- Any additional parameters\n\nExamples:\n\n```javascript\n// Using the default route\nvar url = Router.action('Controller', 'Action'); // eg. /Controller/Action\n\n// Handling optional parameters\nvar url = Router.action('Foo', 'Bar', { id: 123 }); // eg. /Foo/Bar/123\n\n// Appending querystring parameters\nvar url = Router.action('Foo', 'Bar', { hello: 'world' }); // eg. /Foo/Bar?hello=world\n```\n\nThe routes that are exposed are controlled by the web.config \"exposeAllRoutes\" setting for ASP.NET MVC 5 and below:\n```xml\n\u003crouteJs exposeAllRoutes=\"true\" /\u003e\n```\n\nAnd via `Startup.cs` for ASP.NET MVC 6:\n```csharp\nservices.AddRouteJs(config =\u003e {\n\tconfig.ExposeAllRoutes = true;\n});\n```\n\nIf set to \"true\", all of your ASP.NET MVC routes will be exposed to JavaScript, unless you \nexplicitly hide them via the `HideRoutesInJavaScript` attribute on a controller. If set to \"false\", \nall routes will be hidden unless you explicitly use the `ExposeRoutesInJavaScript` attribute on the\ncontroller. These two attributes currently affect all routes for the controller.\n\nChangelog\n=========\n2.2 - 1st July 2017\n-------------------\n - [#53](https://github.com/Daniel15/RouteJs/pull/53) - Upgrade to ASP.NET Core 1.1 RTM\n - Update `AddRouteJs` method to make `configure` argument optional\n\n2.1 - 28th May 2016\n-------------------\n - Updated to ASP.NET Core RC2 \n - [#49](https://github.com/Daniel15/RouteJs/issues/49) - Use `/` as default base URL when empty\n - [#51](https://github.com/Daniel15/RouteJs/issues/51) - Ensure base path ends with `/`\n\n2.0.3 - 20th November 2015\n--------------------------\n - Updated ASP.NET 5 support to RC 1.\n\n2.0.2 - 25th October 2015\n-------------------------\n - Updated ASP.NET 5 support to beta 8.\n - [#43](https://github.com/Daniel15/RouteJs/issues/43) - Add LowerCaseUrls\n   option to convert generated URLs to lowercase. *Thanks to \n   [Mohammad Rahhal](https://github.com/mrahhal)*.\n - [#37](https://github.com/Daniel15/RouteJs/issues/37) - Handle empty URLs\n   (ie. home page).\n \n2.0.1 - 13th September 2015\n---------------------------\n - Updated ASP.NET 5 support to beta 7\n - [#41](https://github.com/Daniel15/RouteJs/issues/41) - Correctly handle when \n   routes in areas have \"area\" default param\n\n2.0 - 23th August 2015\n----------------------\n - Added support for ASP.NET 5 and MVC 6\n\n1.1.9 - 24th January 2015\n-------------------------\n - [#38](https://github.com/Daniel15/RouteJs/issues/38) - Fix handling of constraints with \n   case-insensitive URL parameters.\n\n1.1.8 - 26th October 2014\n-------------------------\n - [#34](https://github.com/Daniel15/RouteJs/issues/34) - Ignore case of controller, action, area, \n   and keys of parameters.\n\n1.1.7 - 6th July 2014\n---------------------\n - [#32](https://github.com/Daniel15/RouteJs/issues/32) - Only include string (regular expression)\n   constraints, ignore custom constraints as they can't be evaluated client-side.\n\n1.1.6 - 27th April 2014\n-----------------------\n - [#31](https://github.com/Daniel15/RouteJs/issues/31) - Defaults and optional parameters are \n   sometimes serialised as null\n\n1.1.5 - 17th November 2013\n--------------------------\n - [#27](https://github.com/Daniel15/RouteJs/issues/27) - NullReferenceException for routes without\n   DataTokens.\n - Added package for ASP.NET MVC 5\n\n1.1.4 - 10th September 2013\n---------------------------\n - [#22](https://github.com/Daniel15/RouteJs/pull/22) and [#24](https://github.com/Daniel15/RouteJs/issues/24) -\n   Handle error when loading types from referenced assemblies.\n\n1.1.3 - 7th August 2013\n-----------------------\n - [#21](https://github.com/Daniel15/RouteJs/issues/21) - NullReferenceException thrown on ignored\n   routes.\n\n1.1.2 - 6th August 2013\n-----------------------\n - [#18](https://github.com/Daniel15/RouteJs/issues/18) - Only expose a route's default area if at \n   least one controller in that route is exposed\n - Small JavaScript cleanup (split huge route method into several smaller methods)\n\n1.1.1 - 26th July 2013\n----------------------\n - [#14](https://github.com/Daniel15/RouteJs/issues/14) - Cache JavaScript for one year\n - [#17](https://github.com/Daniel15/RouteJs/issues/17) - Ensure area route isn't used if area is \n   not specified in `Router.action` call\n\n1.1.0 - 10th June 2013\n----------------------\n - Added support for ASP.NET MVC 2 and 3\n - Bug fixes around T4MVC routes\n - Changed cachebusting hash from querystring parameter to URL path parameter\n\n1.0.1 - 4th June 2013\n---------------------\n - Fixed issue with routes in areas not working correctly\n\n1.0 - 23rd May 2013\n-------------------\n - Initial release\n \nLicence\n=======\n(The MIT licence)\n\nCopyright (C) 2013 Daniel Lo Nigro (Daniel15)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel15%2Froutejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaniel15%2Froutejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel15%2Froutejs/lists"}