back
12 comments
This looks interesting and it would be cool to see more OCaml/web projects.

Other webby things in OCaml include Ocsigen project [1], which is where js_of_ocaml and Lwt came from (for a while there was also the web framework Ohm, but I think development stopped). There are probably many others that I'm not yet aware of.

Personally, I'd love to have a blog-aware static site generator in pure OCaml, that's as straightforward to set up and use as Jekyll -- major bonus points for also being OPAM-aware [2], so you can easily include your packages and docs. So far I haven't found one but I can't be the only one to want this.

[1] http://ocsigen.org

[2] OPAM is the package manager for OCaml.

Edit: I've now added the static-site idea to the MirageOS Pioneer Projects page https://github.com/mirage/mirage-www/wiki/Pioneer-Projects

Have you heard about Stog[1]?

To complete your list there is also Opium[2], which is a very nice minimalistic web framework.

Also there are some interesting web projects listed in Awesome OCaml list[3].

[1]: http://zoggy.github.io/stog/

[2]: https://github.com/rgrinberg/opium

[3]: https://github.com/rizo/awesome-ocaml#web-development

The main reason I wrote this is because I can't find a lightweight web framework for OCaml. I am familiar with ocsigen but I can't even figure out how to navigate around the website nevermind the codebase or documentation. I still have no clue what I'm looking at when on the site. It comes off too "enterprisy."

I just wanted to provide a simple interface in a familiar environment (github) to give beginners a chance to play around with OCaml on the server.

Docs would be highly appreciated.
Definitely, top of my list.
Haven't used it, but I have stumbled upon stog [1], a static site generator in Ocaml that claims to be "kind of Jekyll developed in Ocaml".

[1] http://zoggy.github.io/stog/

I was aware of Stog but wasn't ready to try it out as it didn't seem to be quite what I was after. Seems there have been new releases since back then (and a video) so I'll give it another look.
Added support for templating. Check it out:

https://github.com/eatonphil/owebl/blob/master/examples/temp...

Certainly favours the "O" in OCaml. OO with virtual classes seems to be used instead of functors in various places. Also, you probably want to use an stdlib replacement, this would help you shorten some gnarly functions like get_headers.
I definitely do need to start working with a stdlib replacement. I'm planning to move to Jane Street's Core soon.

I'm still pretty new to OCaml so using functors was not immediately obvious. I did plan to transition to functors for user-level configuration modules. But coming to OCaml from (e.g.) C++ has definitely influenced my default modus operandi.

Thanks for the feedback!

some more feedback: the response code would be bit more readable if you started off with a record type for the args to http_response.

also, a .ml file introduces an automatic module, so you don't need the toplevel module definition in most of your files.

the real world ocaml section on modules is worth reading: https://realworldocaml.org/v1/en/html/files-modules-and-prog...

Great feedback. Record type for the http_response is a good idea.

Right, I really wasn't sure at first how inclusions would work out so I went a little explicit. In some cases, I felt like it was definitely a good layout (rule.ml). But overall, this will be one of the first easy refactors. Thanks!