Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Best Practices in designing
GraphQL APIs that sc...
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Think in Graphs
Model your business domain as
a ...
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Thinking in Graphs
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Authorization &
Fine-grained Access Control
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Traditional GraphQL API
todoItem = {
type: TodoI...
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS AppSync
{
"version" : "2017-02-28",
"operati...
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Naming Matters
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Use Input Types
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Input Types
createUser(name: String!, address: S...
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
API Gateway
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
API Gateway - Resolvers
Interesting use cases
Mi...
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Efficiency
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Reduce round trips to the backend
{
users {
name...
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Writing your own API?
Use DataLoader by Facebook
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS AppSync - Batch Operations
#set($ids = [])
#...
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Design for the future
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
GraphQL VS REST
Rest GraphQL
Thank you!
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Nader Dabit
@dabit3
� 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Best Practices for Designing GraphQL APIs That Scale (MOB420-R1) - AWS re:Invent 2018
Prochain SlideShare
Chargement dans…5
×

Best Practices for Designing GraphQL APIs That Scale (MOB420-R1) - AWS re:Invent 2018

319 vues

Publié le

The emergence of GraphQL over the past couple of years has changed the way people are thinking about API development and is reshaping the way engineering teams are structured by allowing front-end developers to move further up the stack and redefining traditional engineering roles. With the introduction of AWS AppSync, we can easily extend the possibilities of what GraphL is capable of, enabling a single GraphQL API to power entire applications by working with multiple data sources, microservices, and AWS Lambda functions. In this session, we show this architecture in action, walk through the design and implementation, and answer your questions as we dive deep.

  • Login to see the comments

Best Practices for Designing GraphQL APIs That Scale (MOB420-R1) - AWS re:Invent 2018

  1. 1. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Best Practices in designing GraphQL APIs that scale Nader Dabit Developer Advocate AWS Mobile M O B 4 2 0
  2. 2. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  3. 3. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  4. 4. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  5. 5. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  6. 6. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  7. 7. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  8. 8. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  9. 9. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  10. 10. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  11. 11. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Think in Graphs Model your business domain as a graph
  12. 12. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Thinking in Graphs
  13. 13. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Authorization & Fine-grained Access Control
  14. 14. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Traditional GraphQL API todoItem = { type: TodoItemType, args: { id: { type: GraphQLID } }, resolve: (identity, {id}) => TodoItem.get(identity, id) }; class TodoItem { get(identity, id) { // implementation } }
  15. 15. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS AppSync { "version" : "2017-02-28", "operation" : "Query", "index" : "author-index", "query" : { "expression": "author = :author", "expressionValues" : { ":author" : { "S": "${ctx.identity.sub}" } } } }
  16. 16. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Naming Matters
  17. 17. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Use Input Types
  18. 18. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Input Types createUser(name: String!, address: String!, age: Int, address: String, gender: String):User input CreateUserInput { name: String! address: String! age: Int address: String gender: String } createUser(input: CreateUserInput):User Without Input type With Input type
  19. 19. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. API Gateway
  20. 20. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  21. 21. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. API Gateway - Resolvers Interesting use cases Microservices Dynamic delivery of image assets for AR / VR applications Interacting with AI / ML services via a Lambda function Turning an existing REST API into a GraphQL API
  22. 22. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Efficiency
  23. 23. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Reduce round trips to the backend { users { name city friends(first: 10) { name } } } GET:1 GET: friends: 1 : 10
  24. 24. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Writing your own API? Use DataLoader by Facebook
  25. 25. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS AppSync - Batch Operations #set($ids = []) #foreach($id in ${ctx.args.ids}) #set($map = {}) $util.qr($map.put("id", $util.dynamodb.toString($id))) $util.qr($ids.add($map)) #end { "operation" : "BatchGetItem", "tables" : { "Posts": { "keys": $util.toJson($ids) } } }
  26. 26. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Design for the future
  27. 27. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. GraphQL VS REST Rest GraphQL
  28. 28. Thank you! � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Nader Dabit @dabit3
  29. 29. � 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

×