SlideShare a Scribd company logo
Ruben Amortegui
@ramortegui
http://rubenamortegui.com
https://github.com/ramortegui
Absinthe
GraphQL Basics
GraphQL
● A query language for your API
– Ask for what you need, get exactly that.
– Get many resources in a single request
– Describe what is possible with a type system
– Move faster with powerful developer tools
– Bring your own data an code
– Evolve your API without versions
http://graphql.org/
GraphQL as Specification
– Language
– Type System
– Introspection
– Validation
– Execution
– Response
http://facebook.github.io/graphql/October2016/
GraphQL
● Why?
– REST (REpresentational State Transfer)
● What is on the response?
● What if we need more info
● What if we don’t need all the info
● Validations
– GraphQL
● Give the developer a query language to interact with the server
● Provides validation of data by default
● Handle relationships
● Give proper error messages
● What you ask is what you expect
● Single point of entrance
Basic architecture
GraphQL
● It’s not magic
● You need to build the representation of your
data.
Schema sample
Built-in types
Relations
Custom Types
Query representation sample
{
profile{
name
age
friends{
name
}
}
}
What is Absinthe
● GraphQL toolkit for elixir
– absinthe
– absinthe_plug
– absinthe_phoenix
Absinthe
Basic Sample
● Create a API to manage a Todo application.
– Design a Schema
– Query
– Mutation
– Test
“Todo” DB
“Todo” GraphQL Schema
“Todo” GraphQL Schema
● Queries
{
todos {
name
categories {
name
}
}
}
TODO GraphQL
Create a phx app
TODO GraphQL
Create a phx app
TODO GraphQL
Add tables and run migration
TODO GraphQL
Add tables and run migration
TODO GraphQL
Create seed data
TODO GraphQL
Add absinthe library
TODO GraphQL
Add schema
TODO GraphQL
Add routes
TODO GraphQL
Test
Query Sample
TODO GraphQL
Mutation
Other Fun Stuff
● Use variables to do queries
– Unions
– Interfaces
– Fragments
● Create your own Scalar types
– Parse
– Serialize
● Organize your code
– Import fields
– Import types
● Subscriptions
● Publishing your code “middleware”
● Authentication and Authorization
● Tunning Performance
References
● http://graphql.org/
● http://facebook.github.io/graphql/October2016/
● Williams, B. Willson, B. (2017). Craft GraphQL
APIs in Elixir with Absinthe, Beta (Nov. 2017):
The pragmatic programmers.
Next Meetups
● Elixir
– Ecto
– Test
– OTP
Thanks!
Q & A?
@ramortegui
http://rubenamortegui.com
https://github.com/ramortegui

More Related Content

PPTX
Into to GraphQL
PPTX
Introduction to GraphQL
PDF
GraphQL: Enabling a new generation of API developer tools
PPTX
Introduction to graphQL
PDF
Intro to GraphQL
PPTX
Taking Control of your Data with GraphQL
PPTX
GraphQL Introduction
PDF
GraphQL
Into to GraphQL
Introduction to GraphQL
GraphQL: Enabling a new generation of API developer tools
Introduction to graphQL
Intro to GraphQL
Taking Control of your Data with GraphQL
GraphQL Introduction
GraphQL

What's hot (19)

PDF
Hands On - GraphQL
PDF
Modular GraphQL with Schema Stitching
PDF
How to GraphQL
PDF
REST vs GraphQL
PDF
Adding GraphQL to your existing architecture
PDF
GraphQL: The Missing Link Between Frontend and Backend Devs
PDF
PDF
GraphQL + relay
PDF
Introduction to GraphQL
PDF
GraphQL & Relay
PDF
GraphQL ♥︎ GraphDB
PPTX
PDF
GraphQL across the stack: How everything fits together
PDF
The Apollo and GraphQL Stack
PDF
Better APIs with GraphQL
PDF
Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/Meteor
PDF
GraphQL Search
PDF
GraphQL over REST at Reactathon 2018
PDF
Standing out as a new grad candidate
Hands On - GraphQL
Modular GraphQL with Schema Stitching
How to GraphQL
REST vs GraphQL
Adding GraphQL to your existing architecture
GraphQL: The Missing Link Between Frontend and Backend Devs
GraphQL + relay
Introduction to GraphQL
GraphQL & Relay
GraphQL ♥︎ GraphDB
GraphQL across the stack: How everything fits together
The Apollo and GraphQL Stack
Better APIs with GraphQL
Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/Meteor
GraphQL Search
GraphQL over REST at Reactathon 2018
Standing out as a new grad candidate
Ad

Similar to Elixir absinthe-basics (20)

PDF
Elixir + GraphQL = Absinthe 2019.04.10
PDF
GraphQL for Native Apps
PDF
Implementing GraphQL API in Elixir – Victor Deryagin
PPTX
GraphQL.pptx
PPTX
GraphQL.pptx
PDF
GraphQL with .NET Core Microservices.pdf
PDF
Andrea Baldon, Emanuele Di Saverio - GraphQL for Native Apps: the MyAXA case ...
PDF
Graphql
PDF
Functional APIs with Absinthe GraphQL
PDF
apidays LIVE Paris - GraphQL meshes by Jens Neuse
PDF
Testing and Developing GraphQL APIs
PDF
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
PPTX
GraphQL - The new "Lingua Franca" for API-Development
PDF
GraphQL - A love story
PPTX
The API Journey: from REST to GraphQL
PPTX
GraphQL API Crafts presentation
PDF
Marco Liberati - Graph analytics
PDF
PDF
DEVOXX UK 2018 - GraphQL as an alternative approach to REST
PPTX
Introduction to GraphQL
Elixir + GraphQL = Absinthe 2019.04.10
GraphQL for Native Apps
Implementing GraphQL API in Elixir – Victor Deryagin
GraphQL.pptx
GraphQL.pptx
GraphQL with .NET Core Microservices.pdf
Andrea Baldon, Emanuele Di Saverio - GraphQL for Native Apps: the MyAXA case ...
Graphql
Functional APIs with Absinthe GraphQL
apidays LIVE Paris - GraphQL meshes by Jens Neuse
Testing and Developing GraphQL APIs
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
GraphQL - The new "Lingua Franca" for API-Development
GraphQL - A love story
The API Journey: from REST to GraphQL
GraphQL API Crafts presentation
Marco Liberati - Graph analytics
DEVOXX UK 2018 - GraphQL as an alternative approach to REST
Introduction to GraphQL
Ad

More from Ruben Amortegui (9)

PDF
Working with-phoenix
ODP
Elixir koans
ODP
Concurrent programming
ODP
Elixir otp-basics
ODP
Phoenix basics
ODP
Elixir basics-2
ODP
Elixir basics
ODP
From Perl To Elixir
Working with-phoenix
Elixir koans
Concurrent programming
Elixir otp-basics
Phoenix basics
Elixir basics-2
Elixir basics
From Perl To Elixir

Recently uploaded (20)

PDF
Machine learning based COVID-19 study performance prediction
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
KodekX | Application Modernization Development
PPTX
Big Data Technologies - Introduction.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPT
Teaching material agriculture food technology
PDF
cuic standard and advanced reporting.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Spectroscopy.pptx food analysis technology
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Machine learning based COVID-19 study performance prediction
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Agricultural_Statistics_at_a_Glance_2022_0.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Advanced methodologies resolving dimensionality complications for autism neur...
NewMind AI Weekly Chronicles - August'25 Week I
MYSQL Presentation for SQL database connectivity
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
KodekX | Application Modernization Development
Big Data Technologies - Introduction.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Teaching material agriculture food technology
cuic standard and advanced reporting.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Review of recent advances in non-invasive hemoglobin estimation
20250228 LYD VKU AI Blended-Learning.pptx
Encapsulation_ Review paper, used for researhc scholars
Spectroscopy.pptx food analysis technology
Profit Center Accounting in SAP S/4HANA, S4F28 Col11

Elixir absinthe-basics