blob: 3e4c68ce4e63a518b857e0deb601f2f96ba0635d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
open Ppx_yojson_conv_lib.Yojson_conv.Primitives
type message_object = { message : string } [@@deriving yojson]
let routes =
[
Dream.post "/json" (fun req ->
let%lwt body = Dream.body req in
let message_object =
body |> Yojson.Safe.from_string |> message_object_of_yojson
in
`String message_object.message |> Yojson.Safe.to_string |> Dream.json);
]
|