/server/server.ml

http://github.com/hhughes/ocaml-frui · OCaml · 36 lines · 15 code · 5 blank · 16 comment · 0 complexity · f3d871170e2c419fb00c61bec2b7c3e9 MD5 · raw file

  1. (*pp camlp4o -I `ocamlfind query lwt.syntax` lwt-syntax-options.cma lwt-syntax.cma *)
  2. (*
  3. * Copyright (c) 2010 Anil Madhavapeddy <anil@recoil.org>
  4. *
  5. * Permission to use, copy, modify, and distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. *)
  17. open Printf
  18. open Lwt
  19. open Cohttp
  20. open Cohttpserver
  21. let _ =
  22. Lwt_main.run (
  23. let port = 8080 in
  24. let spec = {
  25. Http_daemon.default_spec with
  26. Http_daemon.callback = Dispatch.t;
  27. port = port
  28. }
  29. in
  30. Http_daemon.main spec
  31. )