zenw0lf

zenw0lf

Building a JSON API in Elixir with Phoenix 1.5+

Hello all!

For those wanting to try your hands at Elixir / Phoenix, I wrote a comprehensive tutorial on doing a simple JSON API with said technologies.

Touches on everything: From language installation, app creation, schemas and endpoints, CORS configuration, simple authentication, to sessions (with cookies) and a bit of testing.

I updated it to latest Phoenix version:
Building a JSON API in Elixir with Phoenix 1.5+

Updated link: Build a JSON API with Phoenix - lobo_tuerto's notes

Any feedback is appreciated!

Most Liked

zenw0lf

zenw0lf

I’m thinking about writing one about building a basic GraphQL API with Phoenix and Absinthe in Elixir.
Could also touch on writing a frontend for it using Vue.js + Apollo.

Let me know if this sounds interesting to you people.

19
Post #5
jswny

jswny

Great tutorial! I really appreciate your style of tutorial (I can tell you have thought it through from the introduction)! I’m glad that you went through a bit of testing, which is often neglected these days. Even including things like custom 500 error pages is really nice because these are the things people just glaze over in their tutorials.

I am actually about to start a project where I need to setup Phoenix for a JSON API and I have been wondering about how to do authentication (JWT, API keys, etc.). I’m really glad I came across your tutorial since the session based method that you use seems the most simple and straight forward to me, and it’s in line with much of the authentication I’ve done in the past for Phoenix apps with interfaces.

Thanks again, great work and I really like your blog as well :slight_smile:

ibarch

ibarch

Just FYI, there is a nice book about writing Battleship game using Elixir and Phoenix Channels. The game in the book is called Islands, but it’s the same thing. You would better pick a unique game to attract more readers.

Nullstrike

Nullstrike

Vue.js + apollo would be great.

jung-hunsoo

jung-hunsoo

Looking forward to seeing GraphQL + Absinthe!

Where Next?

Popular in Guides/Tuts Top

sergio
Hey there, we’re going to walk through deploying a Phoenix app to a DigitalOcean droplet, manually - no tools no nothing. Just straight u...
New
sergio
Wrote this guide on how to integrate DropzoneJS with Phoenix Liveview. Hope it helps someone out! https://sergiotapia.com/dropzonejs-dir...
New
smpallen99
Did you know that IO.inspect/2 returns the the first argument and accepts a label option as a second argument. This makes it a perfect to...
New
cheerfulstoic
I spent quite a bit of time trying to find a good configuration to build / test my Elixir app in CircleCI and then push an image to Docke...
New
jtormey
Hello! Having written a lot of LiveView code, I’ve made some VS Code snippets to speed up writing callbacks for LiveViews and LiveCompon...
New
TwistingTwists
This is a thread to note down things/best practices encountered in LiveBeats App as I explore the source code. Found this usage of r...
New
f0rest8
Hi everyone, Just wanted to say that the new Self-referencing many to many guide is now up on the official Hex docs (at least I just not...
New
alejandroErik
POST IN CONSTRUCTION Process for compile erlang otp 20 with odbc-unix for Oracle connections on Solaris 11.3 for 64 bits: Introductio...
New
AstonJ
This blog post hit my timeline earlier, and I’ve also been learning about some fantastic Elixir related tips via @pragdave’s new online c...
New
dennisreimann
I wrote a guide for implementing Passwordless Authentication a.k.a. "Magic Login Links": Feedback welcome!
New

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
peerreynders
Manning 2016 Halloween weekend sale via Deal of the Day Friday, October 28 - Half off all MEAPs - code WM102816LT Saturday, October 29 ...
326 29600 154
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New

We're in Beta

About us Mission Statement