Skip to content

Latest commit

 

History

History
29 lines (20 loc) · 829 Bytes

README.md

File metadata and controls

29 lines (20 loc) · 829 Bytes

ocaml-web-framework

This is an HTTP server and framework written from scratch in OCaml. It uses UNIX sockets and builds up some abstractions to resemble the Sinatra framework.

This is just for fun - use rgrinberg/opium instead!

Thanks to Gary Bernhardt for his HTTP Server from Scratch screencast which inspired this project.

Build etc

$ make
$ make test

Example

open Framework
open Template

let () =
  create_server ()
  |> get "/" (fun req -> h1 ["This is the index page."] |> respond)
  |> get "/:name" (fun req ->
      Printf.sprintf "Hello, %s!" (param req "name") |> respond)
  |> listen 1337