ryanswapp

ryanswapp

I wrote up a little tutorial on setting up a GraphQL server in Phoenix with Absinthe. Here is a link https://ryanswapp.com/2016/11/29/phoenix-graphql-tutorial-with-absinthe/

This is a starting point that I plan to build on. I’ll hopefully have a post up explaining how I’ve done authentication with Absinthe and maybe move into channels and the frontend. Absinthe is great! If you haven’t given it a shot I recommend checking it out :slight_smile:

Showing Posts 1 to 10

jeffdeville

jeffdeville

Thanks Ryan! Added to my reading list.

Oxyrus

Oxyrus

I can’t keep on with the amount of resources people are publishing these days haha, thanks for the post Ryan, definitely looking forward to the rest.

pesnk

pesnk

Forget the rest. just keep the graphql =P

Oxyrus

Oxyrus

It’s still a technology I’m interested in, however I’ve just get into the development of APIs so I don’t see when should I use GraphQL at the moment, but anyway, knowledge is always welcome :smile:

ryanswapp

ryanswapp OP

GraphQL could be considered a replacement for a REST API (or you could have both). REST API’s aren’t bad but they do have some shortcomings (forces you to make multiple calls to the server, returns more data than you need, etc…). GraphQL improves on some of those shortcomings and IMO makes developing an API significantly easier. It’s important to understand REST as it’s a very common API pattern but I think GraphQL is a better alternative.

So, to answer your question, unless you have a hard requirement for a REST API you could skip it altogether and just build a GraphQL API. It is a complete replacement.

Oxyrus

Oxyrus

In the rest APIs you get for instance a json response with some data, and then I can consume it with a front-end technology such as Angular, do I need to include extra packages on the front-end to make a request to a GraphQL API? Or it works with standard HTTP?

ryanswapp

ryanswapp OP

GraphQL also returns a json response. You will likely want to use a client library to send the GraphQL requests though (similar to how you’d use a HTTP client library). There are a few libraries out there at this point to help make sending requests easier (although it’s easy by itself since you just send a string representing your query). You could use Lokka, Apollo, and others. Lokka is pretty basic and is useful for sending queries. Apollo is more full featured and does caching, etc… Just search for GraphQL clients in whatever frontend tech you use and there’s likely to be quite a few.

Oxyrus

Oxyrus

Just finished trying it, great tutorial as always Ryan, looking forward for one about authentication :slight_smile:

petecorey

petecorey

Good stuff!

ryanswapp

ryanswapp OP

I went to your blog to check out the meteor/phoenix auth post and realized you just wrote a very similar post! haha guess it doesn’t hurt to have lots of info out there.

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 92995 915
New
AstonJ
The obligatory hello world thread! Who are you and where are you from? :stuck_out_tongue:
4616 55835 594
New
caslu
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
New
arcanemachine
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New
Herve37
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using. We’re particularly inte...
New
matt-savvy
Is there a word for the ~> symbol used in Version strings? Do you also just call it a Squiggle Arrow™ ?!
New

Other Trending Topics Top

garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
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
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New
aseigo
ICal is a library for interacting with iCalendar data. It parses iCalendars into typed Elixir structs via ICal.from_ics, and can prepare ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews