필요한 리소스만을 요청하고 사용하는 API 만들기
GraphQL + Relay + Serverless߅ഋध @ థ࠶ߢ
View Slide
థ࠶ߢ"#$%&'()*+,-./0123456
ਃೠ ܻࣗझ݅ਸਃೞҊ ࢎਊೞח API ٜ݅ӝI
߄ҳפ߄ҳפীӟ࢚ಿࢸݺ оѺ ߓ࣠࠺ߓ࣠ࣗ25,00012,0002,5002,500࢚ಿ
߄ҳפ߄ҳפীӟ࢚ಿࢸݺ оѺ ߓ࣠࠺ߓ࣠ࣗ25,00012,0002,5002,500࢚ಿProductListCartShippingAddressProductDataProductData
ProductListCartProductDataProductDataShippingAddress/carts/1/products/1/products/2/shippingAddresses/1
/carts/1?fields=products,coupons,shipping_addresses&products[images, descriptions]/carts/1?fields=products,coupons,shipping_addresses&products[images[high,low]]&products[descriptions[reviews, contents]]
/carts_with_products_shipping_address_coupons/carts_with_products_recommendations/carts_with_products_videos/carts_with_products_newsletter_signups/carts_with_products_for_mobile/carts_with_products_for_tablets
BFF (soundcloud)Backends for Frontends
GraphQLA Query Language for API
{me {namecompany}}
{me {name: "߅ഋध"company: "థ࠶ߢ"}}
{me {namecompanyhobby}}
{me {name: "߅ഋध"company: "థ࠶ߢ"hobby: "୷ҳ"}}
QueryREST GET method
RESTGET /me{name: "߅ഋध",company: "థ࠶ߢ",hobby: "୷ҳ",favoriteColor: "ی࢝",country: "ೠҴ",conference: "playnode 2017",cloudProvider: "IBM",age: "?^^^^",address: "??????????",cardNumber: "@#$D@#$#$%#$FD@#$@#"}
GraphQL{user (id: "1") {namecompany}}
GraphQL{user {name: "chulsoo"company: "younghee co."}}
ProductListCartProductDataProductDataShippingAddress/carts/1/products/1/products/2/shippingAddresses/1REST
ProductListCartProductDataProductDataShippingAddress{cart {products {imageUrldescriptionpriceshippingCost}shippingAddress}}POST /graphqlGraphQL
Type System⚙⚙⚙
Typestype Query {cart: Cart}type Cart {products: [Product]!shippingAddress: String!}type Product {imageUrl: String!description: String!price: Int!shippingCost: Int!}{cart {products {imageUrldescriptionpriceshippingCost}shippingAddress}}
MutationREST POST/PUT/PATCH/DELETE Method
Mutationmutation {createProduct(input: {description: "ݧ ৩"price: 50000})} {product {Price}}
؊ب ݈Ҋ ؏ب ݈Ҋٯ ۄо ਗೞח ч݅NO
࠺ऴ ֎ਕ ਃ ୭ࣗച R
Relay
id?GraphQL Relay
id?idGraphQL Relay
GraphQL Relay
GraphQL Relay1
GraphQL Relay11
Server
Serverless
f(⚡)Functions⚡⚡⚡⚡
Serverless= function-as-a-service?
ServerlessPattern / Architecture
ࢲߡ ҙܻ ݽٚѦ ۄ٘ীѱ ݐӝ ☁/provisioning, OS patching/upgrading,scaling, self-healing, … /
Pricing • IBM Cloud functions• 500ms प೯• 512MB @ 5,000,000 ਃ പࣻ• $14.45
Pricing • प೯ दр ⏰• ݫݽܻ ࣗ࠺ • ਃ പࣻ ⚡
“ࢲߡ” ೡ ݽٚѦ ۄ٘ীѱ ݐӝ ☁/API Gateway, Message Queue, Search,Analytics, Authentication, … /
“ࢲߡ”ٜਸ ೣࣻ۽ োѾೞ⚡⚡⚡⚡⚡ ⚡
GraphQLAPI GatewayCartProductSearchMessage QueueObject Storage⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡EmailAuthentication
GraphQL + Relay + Serverless
tumblbug.workable.comହઑੋ दب ӝࣿ ӝ߈ਸ ೣԋ ٜ݅ ࣗਝয ূפযܳ णפ.