Skip to content

mchylek/Endpoints.FSharp.Interop

Repository files navigation

Endpoints.FSharp.Interop

Helper functions for working with Minimal Api in F#.

Provide convenient way to produce request Delegate compatible with IEndpointRouteBuilder. By depending on AsParametersAttribute it allow define parameters bag and apply desired metadata attributes.

Supports AspNet Core 7.0+

example workflow

Installation

Nuget

Install the library from NuGet:

dotnet add package Endpoints.FSharp.Interop

Example usage

Define endpoint that will consume route data.

type HelloRequest = 
    { 
        Logger : ILogger<HelloRequest>
        
        [<FromRoute>]
        Name : string
    }

let hello (req : HelloRequest) = async {
    req.Logger.LogInformation("Hello request handler.")
    return $"Hello {req.Name}!"
}

app.MapGet("/async/{name}", Endpoint.OfAsync hello)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors