JsonBody<'T> Type
Marks a route field as coming from a JSON request body.
The body is deserialized using System.Text.Json with default options.
At most one body marker (JsonBody<'T> or FormBody<'T>) is allowed per route case.
Example
type PostInput = { Title: string; Body: string }
type PostRoute =
| Create of JsonBody<PostInput> * PreCondition<UserId>
let handle route : HttpHandler =
match route with
| Create (JsonBody input, PreCondition userId) ->
Response.ofJson (createPost userId input)
type PostInput =
{
Title: string
Body: string
}
Multiple items
val string: value: 'T -> string
--------------------
type string = System.String
val string: value: 'T -> string
--------------------
type string = System.String
type PostRoute = | Create of obj * obj
val handle: route: PostRoute -> 'a
val route: PostRoute
union case PostRoute.Create: obj * obj -> PostRoute
val input: obj
val userId: obj
Union cases
| Union case |
Description
|
Full Usage:
JsonBody 'T
Parameters:
'T
|
|
Falco.UnionRoutes