Digests » 275
Get discovered by one of the thousands of hiring managers using Vettery to grow their companies’ tech teams with Elixir developers (like you). Here’s how it works: once you create a profile, hiring managers can extend interview requests based on desired salary, top skills, and career preferences. Sign up today - it’s completely free for job-seekers!
this week's favorite
I dabbled in Phoenix for a while now, but never really got my hands dirty with it right up until now. Apart from the whole framework being surprisingly well thought through, there are a few things that strike me as being done exceptionally well in Phoenix, compared to the rest of modern web frameworks.
While working on Elixir project, we often test our functions or modules code in iex shell. Whatever change we make in our code, we fire iex -S mix command and all of our project modules are accessible in shell. Suppose, we have a module say Calculator which is nested under project mathematics directory . As per Elixir naming convention we are going to name that module as Mathematics.Calculator. We also implemented some function say square in this module.
One of the main advantages of Elixir is that it is awesome for server-side systems. Forget using a million different technologies for things like data persistence, background jobs, and service crash recovery, OTP can supply you with everything.
At work, we are currently implementing a GraphQL API in Elixir which fronts and orchestrates several other APIs. Several of the APIs we interact with use OAuth token flows for authentication. We use the OTP GenServer1 behaviour to implement a cache for these tokens. GenServer has worked very well for this use case, but it has proven particularly useful for the more complicated OAuth refresh token flow, which has two separate expiration timelines. Clients invoke a GenServer.call/3 to request a token, and internally the cache uses Process.send_after/4 to implement the expiration timelines.