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!
Trending in Guides/Tuts
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #elixirconf-us
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #performance
- #security











First 10 of 30 Posts!
drakvuf
Thanks! It’s a really nice tutorial.
zenw0lf
You are welcome!
AstonJ
I’ve also bookmarked it
(will go thro it when I’ve finished reading Programming Phoenix)
Thanks - we could definitely do with more tuts like this
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.
gshaw
I’d be interested an updated GraphQL tutorial.
AstonJ
I’d be interested in one for…
(can you tell I’d like to minimise JS!)
And then perhaps:
You could start a poll btw “What kind of tutorial would you like to see?” and see what kind of response you get
Nullstrike
Vue.js + apollo would be great.
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
zenw0lf
Ok, I’ve thinking about the poll idea, and here is the stuff I’ve come up with:
Those are the 3 things I’ve been wanting to dabble in, and plan to get a tutorial out of them.
For the GraphQL API one, it’d be similar to the JSON API one, but you’ll have GraphQL endpoints ready for use with something like
vue-apollo.For the static site generator, I’m currently working on one, the idea is to use it for my own blog to replace Hugo , since I can’t really stand its templating language
And as for the game server, probably will go for a multiplayer Battleship game using Phoenix and WebSockets.
Let me know what y’all think. Thx.
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.
Last Post!
zenw0lf
Thanks for the update!
I’ll make the updates, and will do a full review of the content.