Header menu logo Falco.UnionRoutes

PreconditionExtractor<'E> Type

Registers an extractor for PreCondition or OverridablePreCondition fields.

Create with Extractor.precondition. Each call registers extractors for both PreCondition<T> and OverridablePreCondition<T>.

Each precondition type used in routes must have a corresponding extractor registered in EndpointConfig.

Example

 let config: EndpointConfig<AppError> = {
     Preconditions = [
         yield! Extractor.precondition<UserId, _> (fun ctx ->
             match getAuthCookie ctx with
             | Some id -> Ok id
             | None -> Error NotAuthenticated)
     ]
     // ... other config
 }
val config: 'a
union case Option.Some: Value: 'T -> Option<'T>
val id: x: 'T -> 'T
union case Result.Ok: ResultValue: 'T -> Result<'T,'TError>
union case Option.None: Option<'T>
union case Result.Error: ErrorValue: 'TError -> Result<'T,'TError>

Record fields

Record Field Description

Extract

Full Usage: Extract

Field type: HttpContext -> Task<Result<obj, 'E>>

Extract the value from HTTP context

Field type: HttpContext -> Task<Result<obj, 'E>>

ForType

Full Usage: ForType

Field type: Type

The marker type this extracts (e.g., typeof>)

Field type: Type

Type something to start searching.