Skip to content

Instantly share code, notes, and snippets.

@cedricss
Created October 10, 2011 12:57
Show Gist options
  • Select an option

  • Save cedricss/1275246 to your computer and use it in GitHub Desktop.

Select an option

Save cedricss/1275246 to your computer and use it in GitHub Desktop.
OPA http server serving an "Hello world"

How to run this example?

  • Clone https://github.com/MLstate/opalang
  • Install bld with make install-bld
  • In the opalang root directory, compile opa_http_server.ml with bld opa_http_server.native
  • Run it with _build/opa_http_server.native

Notes

You can disable:

  • cookies with export MLSTATE_HTTP_NO_COOKIE=1
  • access log with export MLSTATE_NO_ACCESS_LOG=1
let dialog () _sched winfo =
HttpServer.make_response
Requestdef.SC_OK "string"
(Http_common.Result ("<h1>Hello world</h1>"))
winfo.HttpServerTypes.cont
let _ =
Runtime.add_httpDialog "default" (HttpDialog.options_with_dialog dialog);
Runtime.add_httpServer "http-server" HttpServer.default_options;
Runtime.start ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment