SihlSourceSihl is a high-level web application framework providing a set of composable building blocks and recipes that allow you to develop web apps quickly and sustainably. Statically typed functional programming with OCaml makes web development fun and safe.
Things like database migrations, HTTP routing, user management, sessions, logging, emailing, job queues and schedules are just a few of the topics Sihl takes care of.
Let's have a look at a tiny Sihl app in a file called sihl.ml:
module Service = struct
module WebServer = Sihl.Web.Server.Service.Opium
end
let hello_page =
Sihl.Web.Route.get "/hello/" (fun _ ->
Sihl.Web.Res.(html |> set_body "Hello!") |> Lwt.return)
;;
let endpoints = [ "/page", [ hello_page ], [] ]
let services = [ Service.WebServer.configure endpoints [ "PORT", "8080" ] ]
let () = Sihl.Core.App.(empty |> with_services services |> run)