{"id":19420521,"url":"https://github.com/giraffe-fsharp/giraffe.tokenrouter","last_synced_at":"2025-04-24T14:32:14.856Z","repository":{"id":29468907,"uuid":"120832793","full_name":"giraffe-fsharp/Giraffe.TokenRouter","owner":"giraffe-fsharp","description":"Alternative routing API for Giraffe web applications which is aimed at maximum performance.","archived":false,"fork":false,"pushed_at":"2023-08-07T14:24:41.000Z","size":75,"stargazers_count":21,"open_issues_count":4,"forks_count":4,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-14T12:56:13.066Z","etag":null,"topics":["aspnet-core","dotnet-core","fsharp","giraffe","http-handler","routing","web"],"latest_commit_sha":null,"homepage":"","language":"F#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/giraffe-fsharp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-08T23:54:45.000Z","updated_at":"2025-01-05T21:39:45.000Z","dependencies_parsed_at":"2024-11-10T13:25:15.011Z","dependency_job_id":"c78f0c44-6ad2-4698-b6ed-6358f1ccd256","html_url":"https://github.com/giraffe-fsharp/Giraffe.TokenRouter","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giraffe-fsharp%2FGiraffe.TokenRouter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giraffe-fsharp%2FGiraffe.TokenRouter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giraffe-fsharp%2FGiraffe.TokenRouter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giraffe-fsharp%2FGiraffe.TokenRouter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/giraffe-fsharp","download_url":"https://codeload.github.com/giraffe-fsharp/Giraffe.TokenRouter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250643521,"owners_count":21464194,"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":["aspnet-core","dotnet-core","fsharp","giraffe","http-handler","routing","web"],"created_at":"2024-11-10T13:23:46.835Z","updated_at":"2025-04-24T14:32:14.578Z","avatar_url":"https://github.com/giraffe-fsharp.png","language":"F#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Giraffe.TokenRouter\n\n![Giraffe](https://raw.githubusercontent.com/giraffe-fsharp/Giraffe/master/giraffe.png)\n\nAlternative routing API for Giraffe web applications which is aimed at maximum performance.\n\n[![NuGet Info](https://buildstats.info/nuget/Giraffe.TokenRouter?includePreReleases=true)](https://www.nuget.org/packages/Giraffe.TokenRouter/)\n\n| Windows | Linux |\n| :------ | :---- |\n| [![Windows Build status](https://ci.appveyor.com/api/projects/status/914030ec0lrc0vti/branch/develop?svg=true)](https://ci.appveyor.com/project/dustinmoris/giraffe-tokenrouter/branch/develop) | [![Linux Build status](https://travis-ci.org/giraffe-fsharp/Giraffe.TokenRouter.svg?branch=develop)](https://travis-ci.org/giraffe-fsharp/Giraffe.TokenRouter/builds?branch=develop) |\n| [![Windows Build history](https://buildstats.info/appveyor/chart/dustinmoris/giraffe-tokenrouter?branch=develop\u0026includeBuildsFromPullRequest=false)](https://ci.appveyor.com/project/dustinmoris/giraffe-tokenrouter/history?branch=develop) | [![Linux Build history](https://buildstats.info/travisci/chart/giraffe-fsharp/Giraffe.TokenRouter?branch=develop\u0026includeBuildsFromPullRequest=false)](https://travis-ci.org/giraffe-fsharp/Giraffe.TokenRouter/builds?branch=develop) |\n\n## Table of contents\n\n- [Documentation](#documentation)\n- [Nightly builds and NuGet feed](#nightly-builds-and-nuget-feed)\n- [More information](#more-information)\n- [License](#license)\n\n## Documentation\n\nThe `Giraffe.TokenRouter` module adds alternative `HttpHandler` functions to route incoming HTTP requests through a basic [Radix Tree](https://en.wikipedia.org/wiki/Radix_tree). Several routing handlers (e.g.: `routef` and `subRoute`) have been overridden in such a way that path matching and value parsing are significantly faster than using the basic `choose` function.\n\nThis implementation assumes that additional memory and compilation time is not an issue. If speed and performance of parsing and path matching is required then the `Giraffe.TokenRouter` is the preferred option.\n\n### router\n\nThe base of all routing decisions is a `router` function instead of the default `choose` function when using the `Giraffe.TokenRouter` module.\n\nThe `router` HttpHandler takes two arguments, a `HttpHandler` to execute when no route can be matched (typical 404 Not Found handler) and secondly a list of all routing functions.\n\n#### Example:\n\nDefining a basic router and routes\n\n```fsharp\nlet notFound = setStatusCode 404 \u003e=\u003e text \"Not found\"\nlet app =\n    router notFound [\n        route \"/\"       (text \"index\")\n        route \"/about\"  (text \"about\")\n    ]\n```\n\n### routing functions\n\nWhen using the `Giraffe.TokenRouter` module the main routing functions have been slightly overridden to match the alternative (speed improved) implementation.\n\nThe `route` and `routef` handlers work the exact same way as before, except that the continuation handler needs to be enclosed in parentheses or captured by the `\u003c|` or `=\u003e` operators.\n\nThe http handlers `GET`, `POST`, `PUT` and `DELETE` are functions which take a list of nested http handler functions similar to before.\n\nThe `subRoute` handler has been altered in order to accept an additional parameter of child routing functions. All child routing functions will presume that the given sub path has been prepended.\n\n#### Example:\n\nDefining a basic router and routes\n\n```fsharp\nlet notFound = setStatusCode 404 \u003e=\u003e text \"Not found\"\nlet app =\n    router notFound [\n        route \"/\"       (text \"index\")\n        route \"/about\"  (text \"about\")\n        routef \"parsing/%s/%i\" (fun (s,i) -\u003e text (sprintf \"Recieved %s \u0026 %i\" s i))\n        subRoute \"/api\" [\n            GET [\n                route \"/\"       (text \"api index\")\n                route \"/about\"  (text \"api about\")\n                subRoute \"/v2\" [\n                    route \"/\"       (text \"api v2 index\")\n                    route \"/about\"  (text \"api v2 about\")\n                ]\n            ]\n\n        ]\n    ]\n```\n\n## Nightly builds and NuGet feed\n\nAll official Giraffe packages are published to the official and public NuGet feed.\n\nUnofficial builds (such as pre-release builds from the `develop` branch and pull requests) produce unofficial pre-release NuGet packages which can be pulled from the project's public NuGet feed on AppVeyor:\n\n```\nhttps://ci.appveyor.com/nuget/giraffe-tokenrouter\n```\n\nIf you add this source to your NuGet CLI or project settings then you can pull unofficial NuGet packages for quick feature testing or urgent hot fixes.\n\n## More information\n\nFor more information about Giraffe, how to set up a development environment, contribution guidelines and more please visit the [main documentation](https://github.com/giraffe-fsharp/Giraffe/blob/master/DOCUMENTATION.md) page.\n\n## License\n\n[Apache 2.0](https://raw.githubusercontent.com/giraffe-fsharp/Giraffe.TokenRouter/master/LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiraffe-fsharp%2Fgiraffe.tokenrouter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgiraffe-fsharp%2Fgiraffe.tokenrouter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiraffe-fsharp%2Fgiraffe.tokenrouter/lists"}