Header menu logo Falco.UnionRoutes

RouteAttribute Type

Attribute to specify route metadata on union cases.

Use this attribute to override the default HTTP method, path, or constraints for a route case. Convention-based routing works without attributes for common patterns.

Type-based constraints (:guid, :int, :long, :bool) are applied automatically from field types. Use Constraints, MinLength, MaxLength, MinValue, MaxValue, and Pattern for additional constraints.

Example

 type UserRoute =
     | [<Route(RouteMethod.Get, Path = "users")>] List
     | [<Route(RouteMethod.Post, Path = "users")>] Create
     | [<Route(Constraints = [| RouteConstraint.Alpha |], MinLength = 3, MaxLength = 50)>]
       Tag of name: string                             // {name:alpha:minlength(3):maxlength(50)}
type UserRoute = | List | Create | Tag of name: string
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 ...
Multiple items
val string: value: 'T -> string

--------------------
type string = System.String

Constructors

Constructor Description

RouteAttribute()

Full Usage: RouteAttribute()

Returns: RouteAttribute

Creates a RouteAttribute with GET as the default method.

Returns: RouteAttribute

RouteAttribute(method)

Full Usage: RouteAttribute(method)

Parameters:
Returns: RouteAttribute
method : RouteMethod
Returns: RouteAttribute

Instance members

Instance member Description

this.Constraints

Full Usage: this.Constraints

Gets or sets explicit route constraints applied to all path fields.

this.MaxLength

Full Usage: this.MaxLength

Gets or sets the maximum string length constraint.

this.MaxValue

Full Usage: this.MaxValue

Gets or sets the maximum integer value constraint.

this.Method

Full Usage: this.Method

Returns: RouteMethod The HTTP method specified for this route case.

Gets the HTTP method for this route.

Returns: RouteMethod

The HTTP method specified for this route case.

this.MinLength

Full Usage: this.MinLength

Gets or sets the minimum string length constraint.

this.MinValue

Full Usage: this.MinValue

Gets or sets the minimum integer value constraint.

this.Path

Full Usage: this.Path

Gets or sets the path pattern for this route segment.

this.Pattern

Full Usage: this.Pattern

Gets or sets a regex pattern constraint.

Type something to start searching.