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)}
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 string: value: 'T -> string
--------------------
type string = System.String
Constructors
| Constructor |
Description
|
|
Creates a RouteAttribute with GET as the default method.
|
|
|
Instance members
| Instance member |
Description
|
Full Usage:
this.Constraints
|
Gets or sets explicit route constraints applied to all path fields. |
Full Usage:
this.MaxLength
|
Gets or sets the maximum string length constraint. |
Full Usage:
this.MaxValue
|
Gets or sets the maximum integer value constraint. |
|
Gets the HTTP method for this route.
|
Full Usage:
this.MinLength
|
Gets or sets the minimum string length constraint. |
Full Usage:
this.MinValue
|
Gets or sets the minimum integer value constraint. |
Full Usage:
this.Path
|
Gets or sets the path pattern for this route segment. |
Full Usage:
this.Pattern
|
Gets or sets a regex pattern constraint. |
Falco.UnionRoutes