Meetup 2: Live coding a web server with OCaml and what's next
· 2 min read
We wrote a Dream web server with a hello world route - ie. you curl
and get the string “hello, world”
from the “/“
endpoint. We started from scratch, empty directory even, and worked our way up. We intend to continue this series, so if you like to catch we what we have so far, here’s what we did so far.
We,
- Created a
package.json
to install a local compiler and build system ( Dune ). - Initialised a project with
dune init proj reason_ocaml_dev
. - Ran the hello world setup by Dune for us with the
dune exec
command. - Installed
ocaml-lsp-server
,ocamlformat
andreason
syntax extension - Referred to https://github.com/ManasJayanth/fullstack-reason-react-demo and wrote the first Dream route (I had never written one before). Made mistakes, saw type errors in action, fixed and for the hello world Dream web server to work.
We have two talk proposals for next meetup, either,
- @shaktimaan introduce us to some more Dream fundamentals and help us understand @ocaml_orgs website.
- Kaushik Hatti will show us getting started with Ocsigen so we can compare notes/experience.
So, we’re meeting up (online) again this Sunday. At 2pm IST.
Code
You can find the code we wrote so far on our Github org. You can reach out me on X at @ManasJayanth if you have any trouble.
Stay in touch with us
Twitter: https://twitter.com/ReasonBangalore