after attending dotScale 2016 I finally got enough motivation to properly start learning Erlang.
From past experience I know that I need a project to play around with while learning a new language. So I decided to work on an outstanding task for traq, my CLI time-tracking tool:
a JSON API to use as a remote storage backend.
While rsync (or dropbox, fwiw) would work great as a solid synchronization mechanism I want an API which allows me to write a mobile app for traq someday.
I’m using rebar3 for the project, and I really like that it’s enforcing OTP conventions and best practices. This way I can focus on my project; the only thing I’m really missing is a standalone formatter. erl_tidy produces code I can not (yet) make much sense of, so I stick to my own source formatting; ideally I’d like to not think about this.
If you happen to write something like rebar3 fmt
please reach out, would love to test & use a tool which unifies source formatting.
The API is using cowboy as HTTP server and jsx for json en- & decoding. The combination of both modules works good; I’m only missing some minor things:
-
a comprehensive tests-first guide to
cowboy
. Information is scarce on how to write acceptance/ integration/ unit tests for http handlers. I’ll probably use etest_http for acceptance tests; the officialcowboy
code base seems to useeunit
heavily, but there seems much boilerplate involved; I’ll probably find a minimal example sooner or later. -
live-reloading of routes in cowboy. sync works great for everything but routes. Probably requires some additional setup.
-
jsx
seems to be unable to encode an array of objects:jsx:encode([ {<<"an">>, <<"example">>} ]),
will produce
{"an": "example"}
but not
[ {"an": "example"} ]
But maybe I’m just overlooking something.
Since I’m very much a beginner at Erlang I will probably learn how to fix all of the above points and get much more fluent with the language in general.
Until then I’ll use the official documentation as much as possible, and Learn you some erlang for specific topics.
All other things aside the current setup works quite well for learning Erlang, which I didn’t expect at first.
Also I’m looking forward to sharing more about my journey into Erlang :)