(** Create the handler for the service *) let nbcar_handler = Dream_handler.handle (module Services_impl.Nb_car) (fun (() : Services_impl.Nb_car.placeholders) body -> Lwt.return_ok Services_impl.Nb_car. { value = body.value; nbcar = Int64.of_int (String.length body.value); }) let capitalize_handler = Dream_handler.handle (module Services_impl.Capitalize) (fun () body -> Lwt.return_ok Services_impl.Capitalize.{ value = String.uppercase_ascii body.value }) (* The handler and the route are not created at the same time because we may want create a specific handler, for example one checking CRSF in the query and can’t infer this from the service signature only *) (** And create the route. *) let nbcar_route = Dream_handler.register (module Services_impl.Nb_car) nbcar_handler and capitalize_route = Dream_handler.register (module Services_impl.Capitalize) capitalize_handler (** Generate a default static page *) let hello : Dream.handler = fun _ -> Dream.html {|