Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #require "cohttp.lwt"
- open Cohttp_lwt_unix
- let program =
- let callback connection request body =
- (* Use the Cohttp.Header module *)
- let headers = Cohttp.Request.headers request in
- Cohttp.Header.to_string headers |> print_endline;
- Server.respond_string ~status:`OK ~body:"<p>Hello World</p>" ()
- in
- let t = Cohttp_lwt_unix.Server.make ~callback () in
- Server.create t
- let () =
- Lwt_main.run program
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement