gen_server
which does HTTP
request using Cowboy Gun library and handles the response as a stream asynchronously. This allows finer control over the HTTP
response and allows to pause, cancel the stream, as well as continue from partially left of streams. The project demonstrates the use of LFE with OTP for writing web services with rebar3 for build and dependency management. Also, there are scripts for loading project env into LFE REPL, giving a full modern development workflow experience.The supervision tree for the app is given below.
┌──────┐
┌───▶│db-sup│
│ └──────┘
│
┌────┐ │ ┌────────────┐
│dnet│────┼───▶│dnet-svc-sup│
└────┘ │ └────────────┘
│
│ ┌────────┐
└───▶│http-sup│
└────────┘
The server listens on port 8080
and has two handlers, one for GET
and another for POST
. The GET
handler returns JSON
and the POST
handler returns HTML
generated using Exemplar.LFE comes with an emacs mode. So I have Spacemacs configuration setup with LFE mode with Lisp and general editor enhancements like rainbow-delimiters, OS X keybindings and such. The LFE mode files are currently configured to load from
~/env/emacs/lfe
directory.