Logo Orsak

EffectRunnerExtensions Type

Creates endpoints from effects with curried route handlers, which are checked against the route format's values when compiling. It works with the same runners and MapEffectEndpoints as Orsak.AspNetCore.

Static members

Static member Description

EffectRunnerExtensions.RouteGet2(this, path, routeHandler)

Full Usage: EffectRunnerExtensions.RouteGet2(this, path, routeHandler)

Parameters:
    this : ^H - The runner, which turns the handler's effect into a request delegate
    path : PrintfFormat<'Printer, unit, unit, ^Eff, ^T> - The route, with format specifiers for the route values
    routeHandler : Expr<^Handler> - Creates the effect that handles a request, from the route values

Returns: Endpoint
Modifiers: inline
Type parameters: ^H, ^Eff, 'Printer, ^T, ^Handler (requires (static member op_MultiplyGreaterGreater : ^Eff * ^H -> Microsoft.AspNetCore.Http.RequestDelegate) and (static member op_MultiplyGreaterGreater : ^Eff * ^H -> Microsoft.AspNetCore.Http.RequestDelegate) and (static member op_MultiplyGreaterGreater : ^Eff * ^H -> Microsoft.AspNetCore.Http.RequestDelegate) and (static member Apply : ^Handler * ^T * Microsoft.FSharp.Core.obj Microsoft.FSharp.Core.array * Orsak.AspNetCore.V2.RouteHandler -> ^Eff))

Creates a GET endpoint for path, handled by routeHandler, a curried function of the route values: string -> int -> 'Eff for "/items/%s/%i", or unit -> 'Eff for a route without values, which is called for every request. A handler that doesn't match the route's values doesn't compile.

The format specifiers are the same as for RouteGet, and the names of the handler's parameters name the route values, so pass a function or a lambda directly.

this : ^H

The runner, which turns the handler's effect into a request delegate

path : PrintfFormat<'Printer, unit, unit, ^Eff, ^T>

The route, with format specifiers for the route values

routeHandler : Expr<^Handler>

Creates the effect that handles a request, from the route values

Returns: Endpoint
Example

 open Orsak.AspNetCore.V2

 let getOrderLine (orderId: int) (line: int) = eff { ... }

 // maps GET /orders/{orderId:int}/lines/{line:int}
 runner.RouteGet2("/orders/%i/lines/%i", getOrderLine)
val getOrderLine: orderId: int -> line: int -> 'a
val orderId: int
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
val line: int

Type something to start searching.