All Projects → giraffe-fsharp → Giraffe.TokenRouter

giraffe-fsharp / Giraffe.TokenRouter

Licence: Apache-2.0 License
Alternative routing API for Giraffe web applications which is aimed at maximum performance.

Programming Languages

F#
602 projects

Projects that are alternatives of or similar to Giraffe.TokenRouter

Giraffe.Razor
Razor view engine http handlers for Giraffe web applications.
Stars: ✭ 27 (+28.57%)
Mutual labels:  aspnet-core, http-handler, giraffe
Giraffe
Giraffe is an F# micro web framework for building rich web applications. It has been heavily inspired and is similar to Suave, but has been specifically designed with ASP.NET Core in mind and can be plugged into the ASP.NET Core pipeline via middleware. Giraffe applications are composed of so called HttpHandler functions which can be thought of a mixture of Suave's WebParts and ASP.NET Core's middleware.
Stars: ✭ 1,703 (+8009.52%)
Mutual labels:  aspnet-core, http-handler, giraffe
Falco
A functional-first toolkit for building brilliant ASP.NET Core applications using F#.
Stars: ✭ 214 (+919.05%)
Mutual labels:  routing, aspnet-core
ngx-model-hacker-news-example
Example repository with Hacker News implementation using Angular, Angular Material & ngx-model
Stars: ✭ 27 (+28.57%)
Mutual labels:  routing
NetgenSiteAccessRoutesBundle
Netgen Siteaccess Routes Bundle is an eZ Publish / eZ Platform bundle which allows you to specify in which siteaccesses or siteaccess groups can a route be used
Stars: ✭ 15 (-28.57%)
Mutual labels:  routing
react-mobx-router5
React components for routing solution using router5 and mobx
Stars: ✭ 58 (+176.19%)
Mutual labels:  routing
angular-routing
Angular 13 Example Routing
Stars: ✭ 21 (+0%)
Mutual labels:  routing
leaflet.TravelNotes
A complete mapping application. With this, you prepare a complete travel, adding itineraries and personnal notes to the map. When you travel is complete, you can save it to a file, export the itineraries to a gpx files, print the itineraries and a roadbook with the notes and itineraries description.
Stars: ✭ 31 (+47.62%)
Mutual labels:  routing
ChatService
ChatService (SignalR).
Stars: ✭ 26 (+23.81%)
Mutual labels:  aspnet-core
go router
The purpose of the go_router for Flutter is to use declarative routes to reduce complexity, regardless of the platform you're targeting (mobile, web, desktop), handling deep linking from Android, iOS and the web while still allowing an easy-to-use developer experience.
Stars: ✭ 380 (+1709.52%)
Mutual labels:  routing
consul-envoy
Consul to Envoy API listener
Stars: ✭ 35 (+66.67%)
Mutual labels:  routing
AspNetCoreMvcSharedLocalization
ASP.NET Core MVC shared localization
Stars: ✭ 31 (+47.62%)
Mutual labels:  aspnet-core
yew-router
Router extension to yew
Stars: ✭ 27 (+28.57%)
Mutual labels:  routing
dowels
🔨 a tiny but powerful javascript library that performs client-side routing, templating, and REST API communication to help you get your single-page web applications running in seconds
Stars: ✭ 13 (-38.1%)
Mutual labels:  routing
purescript-swerve
Swerve is a library that offers a type-level DSL for describing server and client web applications. Inspired by Haskell's Servant library.
Stars: ✭ 20 (-4.76%)
Mutual labels:  routing
ngext
Better routing for Angular
Stars: ✭ 78 (+271.43%)
Mutual labels:  routing
toro
Tree oriented routing
Stars: ✭ 116 (+452.38%)
Mutual labels:  routing
mswjs.io
Official website and documentation for the Mock Service Worker library.
Stars: ✭ 77 (+266.67%)
Mutual labels:  routing
kcd
KCD lets you focus on what matters: coding.
Stars: ✭ 44 (+109.52%)
Mutual labels:  http-handler
r5r
ipeagit.github.io/r5r/
Stars: ✭ 90 (+328.57%)
Mutual labels:  routing

Giraffe.TokenRouter

Giraffe

Alternative routing API for Giraffe web applications which is aimed at maximum performance.

NuGet Info

Windows Linux
Windows Build status Linux Build status
Windows Build history Linux Build history

Table of contents

Documentation

The Giraffe.TokenRouter module adds alternative HttpHandler functions to route incoming HTTP requests through a basic 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.

This 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.

router

The base of all routing decisions is a router function instead of the default choose function when using the Giraffe.TokenRouter module.

The 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.

Example:

Defining a basic router and routes

let notFound = setStatusCode 404 >=> text "Not found"
let app =
    router notFound [
        route "/"       (text "index")
        route "/about"  (text "about")
    ]

routing functions

When using the Giraffe.TokenRouter module the main routing functions have been slightly overridden to match the alternative (speed improved) implementation.

The 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 <| or => operators.

The http handlers GET, POST, PUT and DELETE are functions which take a list of nested http handler functions similar to before.

The 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.

Example:

Defining a basic router and routes

let notFound = setStatusCode 404 >=> text "Not found"
let app =
    router notFound [
        route "/"       (text "index")
        route "/about"  (text "about")
        routef "parsing/%s/%i" (fun (s,i) -> text (sprintf "Recieved %s & %i" s i))
        subRoute "/api" [
            GET [
                route "/"       (text "api index")
                route "/about"  (text "api about")
                subRoute "/v2" [
                    route "/"       (text "api v2 index")
                    route "/about"  (text "api v2 about")
                ]
            ]

        ]
    ]

Nightly builds and NuGet feed

All official Giraffe packages are published to the official and public NuGet feed.

Unofficial 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:

https://ci.appveyor.com/nuget/giraffe-tokenrouter

If 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.

More information

For more information about Giraffe, how to set up a development environment, contribution guidelines and more please visit the main documentation page.

License

Apache 2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].