SlideShare une entreprise Scribd logo
1  sur  18
Télécharger pour lire hors ligne
Par Félix Billon
QUI SUIS-JE ?
Développeur web orienté front-end chez Dcube.
Blog dev web : shakedatcode.fr
@felix_billon
SOMMAIRE
1. API Gateway Pattern
2. GraphQl
3. TypeScript dans tout ça ?
MONOLITICS VS MICROSERVICES
MICROSERVICES : PROBLÈME...
API GATEWAY PATTERN
API GATEWAY PATTERN
API GATEWAY PATTERN : AVANTAGES
Moins d’aller-retour client/services.
Simplification du code client.
Centralisation des middlewares (authentification,
logging, controle du traffic, ...).
Le client doit connaitre un seul endpoint.
API GATEWAY PATTERN :
DÉSAVANTAGES
Ajout d'un nouveau composant.
Doit être HAUTEMENT disponible.
Doit connaître les endpoints des services.
GRAPHQL : EN BREF
Spécification !
By Facebook.
Open source depuis 2015.
Grosse communauté.
Beaucoup d'outils disponible : GraphiQL, GraphQL
Voyager, GraphQL Docs, ...
GRAPHQL : EN BREF
GRAPHQL : TYPE ET SCHÉMA
type Query {
user(id: Int): User
}
type Mutation {
createUser(firstName: String!, lastName: String!): User!
}
type User {
id: Int!
firstName: String!
lastName: String!
posts: [Post]
}
type Post {
id: Int!
title: String!
}
GRAPHQL : RESOLVER
export const resolvers = {
Query: {
user: (obj, args, context) => {
return users.find((user) => user.id === args.id);
}
},
Mutation: {
createUser: (root, args) => {
const newUser = {
id: users.length + 1,
firstName,
lastName
}
users.push(newUser);
return newUser;
}
},
User: {
posts(user) {
t t filt (( t) > t i d Of( t id) ! 1)
GRAPHQL : QUERY
Ressemble très fortement à du JSON.
{
user(id: "10") {
id
firstName
posts {
title
}
}
}
{
"data": {
"user": {
"id": 1,
"firstName": "Felix",
"posts": [
{
"title": "Paris TypeScript #1 was awesome"
},
{
"title": "BestOfWeb rocks"
}
]
}
}
}
GRAPHQL : DEEP DIVE
Subscription : permet de cabler un système de
PubSub.
Dataloader : optimisation des requêtes.
Introspection du graph.
GRAPHQL : CLIENT
TYPESCRIPT DANS TOUS ÇA ?
Génération automatique des annotations de types à
partir du schéma et des requêtes (apollo-codegen,
gql2ts, ts2gql, ...)
Language service (ts-graphql-plugin, graphql-
language-service, ...)
DEMO TIME

Contenu connexe

En vedette

TypeScript: Un lenguaje aburrido para programadores torpes y tristes
TypeScript: Un lenguaje aburrido para programadores torpes y tristesTypeScript: Un lenguaje aburrido para programadores torpes y tristes
TypeScript: Un lenguaje aburrido para programadores torpes y tristesMicael Gallego
 
TypeScript - Silver Bullet for the Full-stack Developers
TypeScript - Silver Bullet for the Full-stack DevelopersTypeScript - Silver Bullet for the Full-stack Developers
TypeScript - Silver Bullet for the Full-stack DevelopersRutenis Turcinas
 
«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21
«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21
«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21MoscowJS
 
TypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponTypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponLaurent Duveau
 
Introducing type script
Introducing type scriptIntroducing type script
Introducing type scriptRemo Jansen
 
002. Introducere in type script
002. Introducere in type script002. Introducere in type script
002. Introducere in type scriptDmitrii Stoian
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript IntroductionDmitry Sheiko
 
Why TypeScript?
Why TypeScript?Why TypeScript?
Why TypeScript?FITC
 
Александр Русаков - TypeScript 2 in action
Александр Русаков - TypeScript 2 in actionАлександр Русаков - TypeScript 2 in action
Александр Русаков - TypeScript 2 in actionMoscowJS
 
TypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the painTypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the painSander Mak (@Sander_Mak)
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java DevelopersYakov Fain
 
Typescript in 30mins
Typescript in 30mins Typescript in 30mins
Typescript in 30mins Udaya Kumar
 

En vedette (19)

TypeScript: Un lenguaje aburrido para programadores torpes y tristes
TypeScript: Un lenguaje aburrido para programadores torpes y tristesTypeScript: Un lenguaje aburrido para programadores torpes y tristes
TypeScript: Un lenguaje aburrido para programadores torpes y tristes
 
Getting started with typescript
Getting started with typescriptGetting started with typescript
Getting started with typescript
 
TypeScript - Silver Bullet for the Full-stack Developers
TypeScript - Silver Bullet for the Full-stack DevelopersTypeScript - Silver Bullet for the Full-stack Developers
TypeScript - Silver Bullet for the Full-stack Developers
 
«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21
«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21
«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21
 
TypeScript Overview
TypeScript OverviewTypeScript Overview
TypeScript Overview
 
TypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponTypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret Weapon
 
Introducing type script
Introducing type scriptIntroducing type script
Introducing type script
 
TypeScript
TypeScriptTypeScript
TypeScript
 
002. Introducere in type script
002. Introducere in type script002. Introducere in type script
002. Introducere in type script
 
Typescript
TypescriptTypescript
Typescript
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
Why TypeScript?
Why TypeScript?Why TypeScript?
Why TypeScript?
 
Александр Русаков - TypeScript 2 in action
Александр Русаков - TypeScript 2 in actionАлександр Русаков - TypeScript 2 in action
Александр Русаков - TypeScript 2 in action
 
TypeScript Presentation
TypeScript PresentationTypeScript Presentation
TypeScript Presentation
 
TypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the painTypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the pain
 
Typescript ppt
Typescript pptTypescript ppt
Typescript ppt
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java Developers
 
Typescript in 30mins
Typescript in 30mins Typescript in 30mins
Typescript in 30mins
 
TypeScriptで快適javascript
TypeScriptで快適javascriptTypeScriptで快適javascript
TypeScriptで快適javascript
 

Similaire à Typescript + Graphql = <3

Cellenza microservices - tour d'horizon - v0.1
Cellenza   microservices - tour d'horizon - v0.1Cellenza   microservices - tour d'horizon - v0.1
Cellenza microservices - tour d'horizon - v0.1Radoine Douhou
 
Êtes-vous API dans votre organisation ?
Êtes-vous API dans votre organisation ?Êtes-vous API dans votre organisation ?
Êtes-vous API dans votre organisation ?OCTO Technology Suisse
 
La Duck Conf - "L'API Management : au-délà des promesses"
La Duck Conf - "L'API Management : au-délà des promesses" La Duck Conf - "L'API Management : au-délà des promesses"
La Duck Conf - "L'API Management : au-délà des promesses" OCTO Technology
 
XebiCon'16 : GS1 - Comment les services managés du Cloud nous ont permis de t...
XebiCon'16 : GS1 - Comment les services managés du Cloud nous ont permis de t...XebiCon'16 : GS1 - Comment les services managés du Cloud nous ont permis de t...
XebiCon'16 : GS1 - Comment les services managés du Cloud nous ont permis de t...Publicis Sapient Engineering
 
LAWS - Crée un site dynamique en serverless c'est possible
LAWS - Crée un site dynamique en serverless c'est possibleLAWS - Crée un site dynamique en serverless c'est possible
LAWS - Crée un site dynamique en serverless c'est possibleRobin Mizreh
 
SPA avec Angular et SignalR (FR)
SPA avec Angular et SignalR (FR)SPA avec Angular et SignalR (FR)
SPA avec Angular et SignalR (FR)Rui Carvalho
 
Gestion des APIs avec Azure API Management - Samir AREZKI
Gestion des APIs avec Azure API Management - Samir AREZKIGestion des APIs avec Azure API Management - Samir AREZKI
Gestion des APIs avec Azure API Management - Samir AREZKISamir Arezki ☁
 
meetup devops aix marseille du 16/05/23
meetup devops aix marseille du 16/05/23meetup devops aix marseille du 16/05/23
meetup devops aix marseille du 16/05/23Frederic Leger
 
Présentation de WAMP.ws, le protocole pour faire du PUB/SUB et RPC over Webso...
Présentation de WAMP.ws, le protocole pour faire du PUB/SUB et RPC over Webso...Présentation de WAMP.ws, le protocole pour faire du PUB/SUB et RPC over Webso...
Présentation de WAMP.ws, le protocole pour faire du PUB/SUB et RPC over Webso...sametmax
 
Petit-Déjeuner : L'API ne fait pas le moine : Confessions d'experts sur les m...
Petit-Déjeuner : L'API ne fait pas le moine : Confessions d'experts sur les m...Petit-Déjeuner : L'API ne fait pas le moine : Confessions d'experts sur les m...
Petit-Déjeuner : L'API ne fait pas le moine : Confessions d'experts sur les m...OCTO Technology
 
ASP.NET MVC 6
ASP.NET MVC 6ASP.NET MVC 6
ASP.NET MVC 6Microsoft
 
LemonLDAP::NG, un WebSSO libre
LemonLDAP::NG, un WebSSO libreLemonLDAP::NG, un WebSSO libre
LemonLDAP::NG, un WebSSO libreClément OUDOT
 
2018-10-18 J2 4D - Implémentez votre prochain assistant personnel d’intranet ...
2018-10-18 J2 4D - Implémentez votre prochain assistant personnel d’intranet ...2018-10-18 J2 4D - Implémentez votre prochain assistant personnel d’intranet ...
2018-10-18 J2 4D - Implémentez votre prochain assistant personnel d’intranet ...Modern Workplace Conference Paris
 
WebSphere Portal & Rich Internet Applications
WebSphere Portal & Rich Internet ApplicationsWebSphere Portal & Rich Internet Applications
WebSphere Portal & Rich Internet ApplicationsVincent Perrin
 
Architectures lambda - Microsoft
Architectures lambda - MicrosoftArchitectures lambda - Microsoft
Architectures lambda - MicrosoftMichel HUBERT
 
Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...
Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...
Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...Jean-Laurent de Morlhon
 

Similaire à Typescript + Graphql = <3 (20)

Cellenza microservices - tour d'horizon - v0.1
Cellenza   microservices - tour d'horizon - v0.1Cellenza   microservices - tour d'horizon - v0.1
Cellenza microservices - tour d'horizon - v0.1
 
Êtes-vous API dans votre organisation ?
Êtes-vous API dans votre organisation ?Êtes-vous API dans votre organisation ?
Êtes-vous API dans votre organisation ?
 
La Duck Conf - "L'API Management : au-délà des promesses"
La Duck Conf - "L'API Management : au-délà des promesses" La Duck Conf - "L'API Management : au-délà des promesses"
La Duck Conf - "L'API Management : au-délà des promesses"
 
XebiCon'16 : GS1 - Comment les services managés du Cloud nous ont permis de t...
XebiCon'16 : GS1 - Comment les services managés du Cloud nous ont permis de t...XebiCon'16 : GS1 - Comment les services managés du Cloud nous ont permis de t...
XebiCon'16 : GS1 - Comment les services managés du Cloud nous ont permis de t...
 
LAWS - Crée un site dynamique en serverless c'est possible
LAWS - Crée un site dynamique en serverless c'est possibleLAWS - Crée un site dynamique en serverless c'est possible
LAWS - Crée un site dynamique en serverless c'est possible
 
Linq Tech Days08 Lux
Linq Tech Days08 LuxLinq Tech Days08 Lux
Linq Tech Days08 Lux
 
SPA avec Angular et SignalR (FR)
SPA avec Angular et SignalR (FR)SPA avec Angular et SignalR (FR)
SPA avec Angular et SignalR (FR)
 
TP GWT JDEV 2015
TP GWT JDEV 2015TP GWT JDEV 2015
TP GWT JDEV 2015
 
Gestion des APIs avec Azure API Management - Samir AREZKI
Gestion des APIs avec Azure API Management - Samir AREZKIGestion des APIs avec Azure API Management - Samir AREZKI
Gestion des APIs avec Azure API Management - Samir AREZKI
 
meetup devops aix marseille du 16/05/23
meetup devops aix marseille du 16/05/23meetup devops aix marseille du 16/05/23
meetup devops aix marseille du 16/05/23
 
Présentation de WAMP.ws, le protocole pour faire du PUB/SUB et RPC over Webso...
Présentation de WAMP.ws, le protocole pour faire du PUB/SUB et RPC over Webso...Présentation de WAMP.ws, le protocole pour faire du PUB/SUB et RPC over Webso...
Présentation de WAMP.ws, le protocole pour faire du PUB/SUB et RPC over Webso...
 
Petit-Déjeuner : L'API ne fait pas le moine : Confessions d'experts sur les m...
Petit-Déjeuner : L'API ne fait pas le moine : Confessions d'experts sur les m...Petit-Déjeuner : L'API ne fait pas le moine : Confessions d'experts sur les m...
Petit-Déjeuner : L'API ne fait pas le moine : Confessions d'experts sur les m...
 
ASP.NET MVC 6
ASP.NET MVC 6ASP.NET MVC 6
ASP.NET MVC 6
 
Refcard GraphQL
Refcard GraphQLRefcard GraphQL
Refcard GraphQL
 
LemonLDAP::NG, un WebSSO libre
LemonLDAP::NG, un WebSSO libreLemonLDAP::NG, un WebSSO libre
LemonLDAP::NG, un WebSSO libre
 
2018-10-18 J2 4D - Implémentez votre prochain assistant personnel d’intranet ...
2018-10-18 J2 4D - Implémentez votre prochain assistant personnel d’intranet ...2018-10-18 J2 4D - Implémentez votre prochain assistant personnel d’intranet ...
2018-10-18 J2 4D - Implémentez votre prochain assistant personnel d’intranet ...
 
WebSphere Portal & Rich Internet Applications
WebSphere Portal & Rich Internet ApplicationsWebSphere Portal & Rich Internet Applications
WebSphere Portal & Rich Internet Applications
 
Architectures lambda - Microsoft
Architectures lambda - MicrosoftArchitectures lambda - Microsoft
Architectures lambda - Microsoft
 
Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...
Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...
Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de ment...
 
API Management
API ManagementAPI Management
API Management
 

Plus de felixbillon

typescript_cdktf.pptx
typescript_cdktf.pptxtypescript_cdktf.pptx
typescript_cdktf.pptxfelixbillon
 
Un problème 10 solutions : Azure Fighter
Un problème 10 solutions : Azure FighterUn problème 10 solutions : Azure Fighter
Un problème 10 solutions : Azure Fighterfelixbillon
 
TypeScript Best Practices
TypeScript Best PracticesTypeScript Best Practices
TypeScript Best Practicesfelixbillon
 
Présentation et dernières nouveautés Microsoft Bot
Présentation et dernières nouveautés Microsoft BotPrésentation et dernières nouveautés Microsoft Bot
Présentation et dernières nouveautés Microsoft Botfelixbillon
 
Global Azure Bootcamp 2018 - Microsoft Bot
Global Azure Bootcamp 2018 - Microsoft BotGlobal Azure Bootcamp 2018 - Microsoft Bot
Global Azure Bootcamp 2018 - Microsoft Botfelixbillon
 
Présentation Google Cloud Vision API
Présentation Google Cloud Vision APIPrésentation Google Cloud Vision API
Présentation Google Cloud Vision APIfelixbillon
 
Service cognitifs : vue d'ensemble
Service cognitifs : vue d'ensembleService cognitifs : vue d'ensemble
Service cognitifs : vue d'ensemblefelixbillon
 
Introduction TypeScript
Introduction TypeScriptIntroduction TypeScript
Introduction TypeScriptfelixbillon
 

Plus de felixbillon (8)

typescript_cdktf.pptx
typescript_cdktf.pptxtypescript_cdktf.pptx
typescript_cdktf.pptx
 
Un problème 10 solutions : Azure Fighter
Un problème 10 solutions : Azure FighterUn problème 10 solutions : Azure Fighter
Un problème 10 solutions : Azure Fighter
 
TypeScript Best Practices
TypeScript Best PracticesTypeScript Best Practices
TypeScript Best Practices
 
Présentation et dernières nouveautés Microsoft Bot
Présentation et dernières nouveautés Microsoft BotPrésentation et dernières nouveautés Microsoft Bot
Présentation et dernières nouveautés Microsoft Bot
 
Global Azure Bootcamp 2018 - Microsoft Bot
Global Azure Bootcamp 2018 - Microsoft BotGlobal Azure Bootcamp 2018 - Microsoft Bot
Global Azure Bootcamp 2018 - Microsoft Bot
 
Présentation Google Cloud Vision API
Présentation Google Cloud Vision APIPrésentation Google Cloud Vision API
Présentation Google Cloud Vision API
 
Service cognitifs : vue d'ensemble
Service cognitifs : vue d'ensembleService cognitifs : vue d'ensemble
Service cognitifs : vue d'ensemble
 
Introduction TypeScript
Introduction TypeScriptIntroduction TypeScript
Introduction TypeScript
 

Typescript + Graphql = <3

  • 2. QUI SUIS-JE ? Développeur web orienté front-end chez Dcube. Blog dev web : shakedatcode.fr @felix_billon
  • 3. SOMMAIRE 1. API Gateway Pattern 2. GraphQl 3. TypeScript dans tout ça ?
  • 8. API GATEWAY PATTERN : AVANTAGES Moins d’aller-retour client/services. Simplification du code client. Centralisation des middlewares (authentification, logging, controle du traffic, ...). Le client doit connaitre un seul endpoint.
  • 9. API GATEWAY PATTERN : DÉSAVANTAGES Ajout d'un nouveau composant. Doit être HAUTEMENT disponible. Doit connaître les endpoints des services.
  • 10. GRAPHQL : EN BREF Spécification ! By Facebook. Open source depuis 2015. Grosse communauté. Beaucoup d'outils disponible : GraphiQL, GraphQL Voyager, GraphQL Docs, ...
  • 11. GRAPHQL : EN BREF
  • 12. GRAPHQL : TYPE ET SCHÉMA type Query { user(id: Int): User } type Mutation { createUser(firstName: String!, lastName: String!): User! } type User { id: Int! firstName: String! lastName: String! posts: [Post] } type Post { id: Int! title: String! }
  • 13. GRAPHQL : RESOLVER export const resolvers = { Query: { user: (obj, args, context) => { return users.find((user) => user.id === args.id); } }, Mutation: { createUser: (root, args) => { const newUser = { id: users.length + 1, firstName, lastName } users.push(newUser); return newUser; } }, User: { posts(user) { t t filt (( t) > t i d Of( t id) ! 1)
  • 14. GRAPHQL : QUERY Ressemble très fortement à du JSON. { user(id: "10") { id firstName posts { title } } } { "data": { "user": { "id": 1, "firstName": "Felix", "posts": [ { "title": "Paris TypeScript #1 was awesome" }, { "title": "BestOfWeb rocks" } ] } } }
  • 15. GRAPHQL : DEEP DIVE Subscription : permet de cabler un système de PubSub. Dataloader : optimisation des requêtes. Introspection du graph.
  • 17. TYPESCRIPT DANS TOUS ÇA ? Génération automatique des annotations de types à partir du schéma et des requêtes (apollo-codegen, gql2ts, ts2gql, ...) Language service (ts-graphql-plugin, graphql- language-service, ...)