Header menu logo Falco.UnionRoutes

EndpointConfig<'E> Type

Configuration for Route.endpoints - bundles all extraction settings.

This record combines all the pieces needed for route extraction:

  • Precondition extractors for auth/validation
  • Custom parsers for domain types
  • Error handling functions

Example

 let config: EndpointConfig<AppError> = {
     Preconditions = [ yield! Extractor.precondition<UserId, _> requireAuth ]
     Parsers = [ Extractor.parser<Slug> slugParser ]
     MakeError = fun msg -> BadRequest msg
     CombineErrors = fun errors -> errors |> List.head
     ToErrorResponse = fun e -> Response.withStatusCode 400 >> Response.ofPlainText (string e)
 }

 let endpoints = Route.endpoints config routeHandler
val config: 'a
Multiple items
module List from Microsoft.FSharp.Collections

--------------------
type List<'T> = | op_Nil | op_ColonColon of Head: 'T * Tail: 'T list interface IReadOnlyList<'T> interface IReadOnlyCollection<'T> interface IEnumerable interface IEnumerable<'T> member GetReverseIndex: rank: int * offset: int -> int member GetSlice: startIndex: int option * endIndex: int option -> 'T list static member Cons: head: 'T * tail: 'T list -> 'T list member Head: 'T with get member IsEmpty: bool with get member Item: index: int -> 'T with get ...
val head: list: 'T list -> 'T
Multiple items
val string: value: 'T -> string

--------------------
type string = System.String
val endpoints: obj

Record fields

Record Field Description

CombineErrors

Full Usage: CombineErrors

Field type: 'E list -> 'E

Reduces multiple field errors into one when more than one field fails.

Field type: 'E list -> 'E

MakeError

Full Usage: MakeError

Field type: string -> 'E

Converts a route/query parsing error message (string) into your error type.

Field type: string -> 'E

Parsers

Full Usage: Parsers

Field type: FieldParser list

Parsers for custom types in route/query parameters. Create with Extractor.parser. Built-in types are handled automatically.

Field type: FieldParser list

Preconditions

Full Usage: Preconditions

Field type: PreconditionExtractor<'E> list

Extractors for PreCondition<'T> and OverridablePreCondition<'T> fields. Create with Extractor.precondition (covers both types).

Field type: PreconditionExtractor<'E> list

ToErrorResponse

Full Usage: ToErrorResponse

Field type: 'E -> HttpHandler

Converts the final error into an HTTP response sent to the client.

Field type: 'E -> HttpHandler

Type something to start searching.