{"id":17061329,"url":"https://github.com/filipw/strathweb.typedrouting","last_synced_at":"2025-04-12T18:12:03.117Z","repository":{"id":18528018,"uuid":"21728371","full_name":"filipw/Strathweb.TypedRouting","owner":"filipw","description":null,"archived":false,"fork":false,"pushed_at":"2015-02-01T17:50:47.000Z","size":617,"stargazers_count":16,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-12T18:11:57.995Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/filipw.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":"2014-07-11T08:29:22.000Z","updated_at":"2023-08-29T10:42:21.000Z","dependencies_parsed_at":"2022-08-05T00:00:15.764Z","dependency_job_id":null,"html_url":"https://github.com/filipw/Strathweb.TypedRouting","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/filipw%2FStrathweb.TypedRouting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filipw%2FStrathweb.TypedRouting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filipw%2FStrathweb.TypedRouting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filipw%2FStrathweb.TypedRouting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/filipw","download_url":"https://codeload.github.com/filipw/Strathweb.TypedRouting/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248610341,"owners_count":21132919,"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-14T10:46:47.705Z","updated_at":"2025-04-12T18:12:03.094Z","avatar_url":"https://github.com/filipw.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"Strathweb.TypedRouting\n======================\n\nA library allowing you to define Web API 2 direct routes using strongly typed, centralized syntax. This allows you to ensure tht whenever you refactor your application, the routes will not break.\n\n### Installation and requirements\n\n`TypedRouting` works only with Web API 2.2+. The abstractions used to build up the library were only introduced in the 2.2 release of the framework. Internally, `TypedRouting` is an implementation of `IDirectRouteProvider` - same mechanism as used by attribute routing.\n\nYou can grab the package from Nuget:\n\n    install-package Strathweb.TypedRouting\n\n### Usage example\n\nConsider the sample controller:\n\n    public class TestController : ApiController \n    {\n        public HttpResponseMessage Get()\n        {\n          //omitted for brevity\n        }\n        \n        public HttpResponseMessage GetById(int id)\n        {\n          //omitted for brevity\n        }\n    }\n\nYou define the routes to this controller with `TypedRouting` using the following syntax:\n\n    var config = new HttpConfiguration();\n    config.EnableTypedRouting();\n \n    config.TypedRoute(\"test\", c =\u003e c.Action\u003cTestController\u003e(x =\u003e x.Get()));\n    config.TypedRoute(\"test/{id:int}\", c =\u003e c.Action\u003cTestController\u003e(x =\u003e x.GetById(Param.Any\u003cint\u003e())));\n\nYou can use the fluent API to give the route a name (so that you can use it with `UrlHelper` and other libraries requiring you to reference routes by name:\n\n    config.TypedRoute(\"test\", c =\u003e c.Action\u003cTestController\u003e(x =\u003e x.Get().Name(\"getTest\"));\n    \n`TypedRouting` works well with `UrlHelper` and with [Drum](https://github.com/pmhsfelix/drum)\n\n### Blog post\n\n[Read more](http://www.strathweb.com/2014/07/building-strongly-typed-route-provider-asp-net-web-api/) at my blog\n\n### License\n\n2014 Filip W [MIT](https://github.com/filipw/Strathweb.TypedRouting/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilipw%2Fstrathweb.typedrouting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffilipw%2Fstrathweb.typedrouting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilipw%2Fstrathweb.typedrouting/lists"}