SlideShare a Scribd company logo
1 of 20
Introducción a graphQL
¿Por qué es tan popular?
alevsk @
¿Qué es GraphQL?
● Query language creado por Facebook en 2012
● Es una interfaz entre el cliente y el servidor para pedir y manipular datos
● El cliente define la respuesta que quiere obtener del servidor
Principal diferencia con REST
GET
POST
PUT
DELETE
...
REST es bueno :)
Ejemplo: GET /users/1/friends
Ventajas:
● Muy descriptivo, estamos solicitando los amigos del usuario con id = 1
● URL path único para un recurso en particular
● Cacheable
Pero tiene limitaciones :(
Estoy seguro que han visto algo asi:
GET /users/1/friends/1/dogs/1?include=user.name,dog.age
Desventajas:
● Complicado de incluir datos en la respuesta
● Complicado de excluir datos de la respuesta
● Multiples request para obtener
GraphQL al rescate :)
Con graphQL incluso puedes hacer esto :)
movies {
id
actors {
name
movies {
id
actors {
name
movies {
....
}
}
}
}
Schemas (Describir los datos que regresaremos)
● Describir nuestros modelos
● Relaciones entre los modelos
● Exponer sus campos / datos
Types
● Int
● Float
● String
● Boolean
● Object
● [Int]
● [Float]
● [String]
● [Boolean]
● [Object]
● Int!
● Float!
● String!
● Boolean!
● Object!
● [Int]!
● [Float]!
● [String]!
● [Boolean]!
● [Object]!
Queries y Mutations
Queries = Leer datos del servidor (por lo general extraidos de una db)
Mutations = Crear / modificar / borrar datos en el servidor
Ejemplo: Película, actores y comentarios
movieQL.js
movieQL.js
actorQL.js
commentQL.js
Query
Mutations
graphQL Schema
Poniendo todo junto
Y jugando con graphiQL
Dudas preguntas y
mentadas
Demo: https://github.com/Alevsk/graphql-demo-server
@Alevsk
https://www.alevsk.com
https://github.com/alevsk
Gracias
We are hiring! https://freeagent.network/jobs

More Related Content

What's hot

The Apollo and GraphQL Stack
The Apollo and GraphQL StackThe Apollo and GraphQL Stack
The Apollo and GraphQL Stack
Sashko Stubailo
 
How I learned to time travel, or, data pipelining and scheduling with Airflow
How I learned to time travel, or, data pipelining and scheduling with AirflowHow I learned to time travel, or, data pipelining and scheduling with Airflow
How I learned to time travel, or, data pipelining and scheduling with Airflow
PyData
 
jpa-hibernate-presentation
jpa-hibernate-presentationjpa-hibernate-presentation
jpa-hibernate-presentation
John Slick
 

What's hot (20)

The Apollo and GraphQL Stack
The Apollo and GraphQL StackThe Apollo and GraphQL Stack
The Apollo and GraphQL Stack
 
Apache Calcite (a tutorial given at BOSS '21)
Apache Calcite (a tutorial given at BOSS '21)Apache Calcite (a tutorial given at BOSS '21)
Apache Calcite (a tutorial given at BOSS '21)
 
Understanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple StepsUnderstanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple Steps
 
API
APIAPI
API
 
Intro to GraphQL
 Intro to GraphQL Intro to GraphQL
Intro to GraphQL
 
How I learned to time travel, or, data pipelining and scheduling with Airflow
How I learned to time travel, or, data pipelining and scheduling with AirflowHow I learned to time travel, or, data pipelining and scheduling with Airflow
How I learned to time travel, or, data pipelining and scheduling with Airflow
 
Apache airflow
Apache airflowApache airflow
Apache airflow
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java Developers
 
REST vs GraphQL
REST vs GraphQLREST vs GraphQL
REST vs GraphQL
 
CDC Stream Processing with Apache Flink
CDC Stream Processing with Apache FlinkCDC Stream Processing with Apache Flink
CDC Stream Processing with Apache Flink
 
PostgreSQL Advanced Queries
PostgreSQL Advanced QueriesPostgreSQL Advanced Queries
PostgreSQL Advanced Queries
 
Tutorial: Building a GraphQL API in PHP
Tutorial: Building a GraphQL API in PHPTutorial: Building a GraphQL API in PHP
Tutorial: Building a GraphQL API in PHP
 
Open Policy Agent
Open Policy AgentOpen Policy Agent
Open Policy Agent
 
Deploying Flink on Kubernetes - David Anderson
 Deploying Flink on Kubernetes - David Anderson Deploying Flink on Kubernetes - David Anderson
Deploying Flink on Kubernetes - David Anderson
 
Understanding REST
Understanding RESTUnderstanding REST
Understanding REST
 
API Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid Rahimian
API Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid RahimianAPI Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid Rahimian
API Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid Rahimian
 
jpa-hibernate-presentation
jpa-hibernate-presentationjpa-hibernate-presentation
jpa-hibernate-presentation
 
NiFi Best Practices for the Enterprise
NiFi Best Practices for the EnterpriseNiFi Best Practices for the Enterprise
NiFi Best Practices for the Enterprise
 
Programming the Semantic Web
Programming the Semantic WebProgramming the Semantic Web
Programming the Semantic Web
 
Data all over the place! How SQL and Apache Calcite bring sanity to streaming...
Data all over the place! How SQL and Apache Calcite bring sanity to streaming...Data all over the place! How SQL and Apache Calcite bring sanity to streaming...
Data all over the place! How SQL and Apache Calcite bring sanity to streaming...
 

Similar to Introducción a GraphQL

Ejb30 3
Ejb30 3 Ejb30 3
Ejb30 3
oscar
 
Guia de estudio para Oracle Certified Java EE 6 Web Component Developer
Guia de estudio para Oracle Certified Java EE 6 Web Component DeveloperGuia de estudio para Oracle Certified Java EE 6 Web Component Developer
Guia de estudio para Oracle Certified Java EE 6 Web Component Developer
Oscar V
 
TR1 - FORMATO ALUMNO ROJAS RIVERA ANGEL.DOCX
TR1 - FORMATO ALUMNO ROJAS RIVERA ANGEL.DOCXTR1 - FORMATO ALUMNO ROJAS RIVERA ANGEL.DOCX
TR1 - FORMATO ALUMNO ROJAS RIVERA ANGEL.DOCX
RojasAngel2
 
Consumo de endpoint Sparql desde Drupal
Consumo de endpoint Sparql desde DrupalConsumo de endpoint Sparql desde Drupal
Consumo de endpoint Sparql desde Drupal
Pablo Martín Muñoz
 

Similar to Introducción a GraphQL (17)

Ejb30 3
Ejb30 3 Ejb30 3
Ejb30 3
 
Html5, Rest, JSON, Angular JS y Java EE 7 - Aplicaciones Web Modernas y Esca...
Html5, Rest, JSON, Angular JS y Java EE 7  - Aplicaciones Web Modernas y Esca...Html5, Rest, JSON, Angular JS y Java EE 7  - Aplicaciones Web Modernas y Esca...
Html5, Rest, JSON, Angular JS y Java EE 7 - Aplicaciones Web Modernas y Esca...
 
Android web services - Spring Android
Android web services - Spring AndroidAndroid web services - Spring Android
Android web services - Spring Android
 
Java Web JSTL
Java Web JSTLJava Web JSTL
Java Web JSTL
 
Guia de estudio para Oracle Certified Java EE 6 Web Component Developer
Guia de estudio para Oracle Certified Java EE 6 Web Component DeveloperGuia de estudio para Oracle Certified Java EE 6 Web Component Developer
Guia de estudio para Oracle Certified Java EE 6 Web Component Developer
 
TR1 - FORMATO ALUMNO ROJAS RIVERA ANGEL.DOCX
TR1 - FORMATO ALUMNO ROJAS RIVERA ANGEL.DOCXTR1 - FORMATO ALUMNO ROJAS RIVERA ANGEL.DOCX
TR1 - FORMATO ALUMNO ROJAS RIVERA ANGEL.DOCX
 
Jsp
JspJsp
Jsp
 
Coders cantabria - Junio (Offline First)
Coders cantabria - Junio (Offline First)Coders cantabria - Junio (Offline First)
Coders cantabria - Junio (Offline First)
 
Tema 4 3_1_interfaces_de_usuario
Tema 4 3_1_interfaces_de_usuarioTema 4 3_1_interfaces_de_usuario
Tema 4 3_1_interfaces_de_usuario
 
Groogle
GroogleGroogle
Groogle
 
Sincronizando Azure Search con SQL Server
Sincronizando Azure Search con SQL ServerSincronizando Azure Search con SQL Server
Sincronizando Azure Search con SQL Server
 
Tecnologias_WEB.pdf
Tecnologias_WEB.pdfTecnologias_WEB.pdf
Tecnologias_WEB.pdf
 
Java web Lección 04 - JSTL
Java web Lección 04 - JSTLJava web Lección 04 - JSTL
Java web Lección 04 - JSTL
 
Introduccion
IntroduccionIntroduccion
Introduccion
 
Introduccion
IntroduccionIntroduccion
Introduccion
 
[ES] Introducción a Java EE 7 & HTML 5
[ES] Introducción a Java EE 7 & HTML 5[ES] Introducción a Java EE 7 & HTML 5
[ES] Introducción a Java EE 7 & HTML 5
 
Consumo de endpoint Sparql desde Drupal
Consumo de endpoint Sparql desde DrupalConsumo de endpoint Sparql desde Drupal
Consumo de endpoint Sparql desde Drupal
 

More from Lenin Alevski Huerta Arias (7)

Contraseñas seguras
Contraseñas segurasContraseñas seguras
Contraseñas seguras
 
Introducción al hacking y la seguridad informatica
Introducción al hacking y la seguridad informaticaIntroducción al hacking y la seguridad informatica
Introducción al hacking y la seguridad informatica
 
¿Quieres comenzar tu Startup?
¿Quieres comenzar tu Startup?¿Quieres comenzar tu Startup?
¿Quieres comenzar tu Startup?
 
Desarrollo responsivo con CakePHP y Foundation
Desarrollo responsivo con CakePHP y FoundationDesarrollo responsivo con CakePHP y Foundation
Desarrollo responsivo con CakePHP y Foundation
 
Big Data from cheap phones
Big Data from cheap phonesBig Data from cheap phones
Big Data from cheap phones
 
Logisitics innovation
Logisitics innovationLogisitics innovation
Logisitics innovation
 
Inteligencia de negocios
Inteligencia de negociosInteligencia de negocios
Inteligencia de negocios
 

Recently uploaded

redes informaticas en una oficina administrativa
redes informaticas en una oficina administrativaredes informaticas en una oficina administrativa
redes informaticas en una oficina administrativa
nicho110
 

Recently uploaded (12)

PROYECTO FINAL. Tutorial para publicar en SlideShare.pptx
PROYECTO FINAL. Tutorial para publicar en SlideShare.pptxPROYECTO FINAL. Tutorial para publicar en SlideShare.pptx
PROYECTO FINAL. Tutorial para publicar en SlideShare.pptx
 
Innovaciones tecnologicas en el siglo 21
Innovaciones tecnologicas en el siglo 21Innovaciones tecnologicas en el siglo 21
Innovaciones tecnologicas en el siglo 21
 
EL CICLO PRÁCTICO DE UN MOTOR DE CUATRO TIEMPOS.pptx
EL CICLO PRÁCTICO DE UN MOTOR DE CUATRO TIEMPOS.pptxEL CICLO PRÁCTICO DE UN MOTOR DE CUATRO TIEMPOS.pptx
EL CICLO PRÁCTICO DE UN MOTOR DE CUATRO TIEMPOS.pptx
 
redes informaticas en una oficina administrativa
redes informaticas en una oficina administrativaredes informaticas en una oficina administrativa
redes informaticas en una oficina administrativa
 
Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...
Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...
Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...
 
Avances tecnológicos del siglo XXI y ejemplos de estos
Avances tecnológicos del siglo XXI y ejemplos de estosAvances tecnológicos del siglo XXI y ejemplos de estos
Avances tecnológicos del siglo XXI y ejemplos de estos
 
investigación de los Avances tecnológicos del siglo XXI
investigación de los Avances tecnológicos del siglo XXIinvestigación de los Avances tecnológicos del siglo XXI
investigación de los Avances tecnológicos del siglo XXI
 
pruebas unitarias unitarias en java con JUNIT
pruebas unitarias unitarias en java con JUNITpruebas unitarias unitarias en java con JUNIT
pruebas unitarias unitarias en java con JUNIT
 
EVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptx
EVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptxEVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptx
EVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptx
 
Buenos_Aires_Meetup_Redis_20240430_.pptx
Buenos_Aires_Meetup_Redis_20240430_.pptxBuenos_Aires_Meetup_Redis_20240430_.pptx
Buenos_Aires_Meetup_Redis_20240430_.pptx
 
Avances tecnológicos del siglo XXI 10-07 eyvana
Avances tecnológicos del siglo XXI 10-07 eyvanaAvances tecnológicos del siglo XXI 10-07 eyvana
Avances tecnológicos del siglo XXI 10-07 eyvana
 
How to use Redis with MuleSoft. A quick start presentation.
How to use Redis with MuleSoft. A quick start presentation.How to use Redis with MuleSoft. A quick start presentation.
How to use Redis with MuleSoft. A quick start presentation.
 

Introducción a GraphQL

Editor's Notes

  1. GraphQL is a query language for your API Uses HTTP Client defines the response body
  2. REST = multiples endpoints, multiples HTTP commands GraphQL = 1 solo endpoint, la mayoría del tiempo solo son POST request Cada comando HTTP tiene una funcion bien especifica en el servidor lo cual es bueno, pero tambien te forza a realizar multiples peticiones al servidor
  3. The disadvantage is that it's hard to specify and implement advanced requests with includes, excludes and especially with linked resources.
  4. Los schemas nos permiten describir nuestros modelos, relacionarlos entre si y exponer sus datos. Hablar sobre tips de seguridad en schemas, no exponer datos sensibles, manejar datos por default, etc