Advertisement
Guest User

Untitled

a guest
Dec 1st, 2016
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #require "cohttp.lwt"
  2.  
  3. open Cohttp_lwt_unix
  4.  
  5. let program =
  6. let callback connection request body =
  7. (* Use the Cohttp.Header module *)
  8. let headers = Cohttp.Request.headers request in
  9. Cohttp.Header.to_string headers |> print_endline;
  10. Server.respond_string ~status:`OK ~body:"<p>Hello World</p>" ()
  11. in
  12. let t = Cohttp_lwt_unix.Server.make ~callback () in
  13. Server.create t
  14.  
  15. let () =
  16. Lwt_main.run program
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement