Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let%server get_status () =
- let open Uri in
- let open Cohttp in
- let open Cohttp_lwt_unix in
- let open Lwt in
- let uri = "localhost/api/_status" in
- let uri = Uri.of_string uri in
- let uri = Uri.with_port uri (Some 59231) in
- Client.get uri >|= fun (resp, body) -> resp |> Response.status |> Code.code_of_status
- let%client get_status = ~%(Eliom_client.server_function [%derive.json: unit] get_status)
- let a_button =
- let b = Html.D.(button ~a:[a_class ["btn"]] [txt ""]) in
- ignore [%client
- ((Lwt.async @@ fun () ->
- let%lwt status_value = get_status () in
- let b = Html.D.(th ~a:[a_class ["trading_column_header"]] [txt @@ string_of_int status_value]) in
- Lwt.return_unit
- ))];
- b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement