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 ![]()
Trending in Discussions
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...
New
Hey there,
It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Quite interesting article Google brought me. Didn’t find any mentions about it here.
What do you think in general? Would you use togethe...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Since we have deprecated our Erlang sections (as we have dedicated Erlang Forums now) let’s add this thread for those who’d like to post ...
New
:warning: Security advisory: Decimal DoS vulnerability
A vulnerability has been published for decimal where very large exponents can cau...
New
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
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security











Showing Posts 22 to 13- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
ryanswapp
I apologize for not seeing this sooner. Somehow it got past me! Pretty late but here are a few reasons why I like GraphQL.
One HTTP Request - GraphQL makes only one HTTP request. Using another pattern like REST you would generally have to make a number of HTTP requests to get data from different resources. With GraphQL, you send one query to the server and it sends back all the data you need without having to make multiple requests.
Type Checking - In GraphQL you define the fields and types that can be queried or that can be input into a mutation. As a result, you get data validation out of the box. You don’t have to do any type checking on mutation arguments because GraphQL already does it for you.
Querying Nested Data - Let’s say you have an app that lawyers use to manage their cases. Each lawyer can have many cases. The case has a foreign key property called lawyer_id. With GraphQL, I can set up a lawyer field that takes the lawyer_id on a case and requests the lawyer’s data. So, I could query for a case like this:
This comes in really handy with complex schemas.
There are a quite a few more benefits but I think the best way to identify them is to build something. Let me know if you have any questions.
johninvictus
@ryanswapp
Why would you recommend someone to use GraphQl,
I have never used it but am wondering how could I create a login system with it etc
Ps: am a currently learning Elixir
vic
For those interested on using Absinthe with Apollo client via Phoenix channels, I just released a custom Apollo networkInterface just for that: apollo-phoenix-websocket
piyushcoader
can’t wait to see it man. and i wish i can contribute as well
benwilson512
Hey there, this is a great question. Most of the stuff you see with GraphQL is using it to power an API. However we have an experimental project we hope to release very very soon that lets you use graphql to power totally ordinary Phoenix views.
piyushcoader
great stuff man loved it. just a noob question . can we use phoenix template with graphql?
hlx
Thanks! Will test this out
ryanswapp
Thanks! Good question… I was just thinking about this myself. I haven’t yet tried this out but I think it would work. You could do something like this:
hlx
Hey Ryan, great article!
I’m trying to hack together an Absinthe app (without Phoenix) and I was wondering how you would split the Schema (into multiple files) before it becomes to big.
I’m using an Electron based client, graphiql-app, because it allow me to set custom headers (e.g. for authentication)
Oxyrus
Seems like by default, the apollo client makes the requests to “/graphql”, Ryan instead, set it to “/api”. that was all