@__xuorig__ module Api class GraphqlController < ApiController def query # ... result = MySchema.query( query_string, variables: variables, context: context ) render json: result end end end
@__xuorig__ # Product Type field :image do type ImageType resolve -> (product, args, ctx) do product.image end end # Shop Type field :products do type [ProductType] resolve -> (shop, args, ctx) do shop.products end end
@__xuorig__ Client Server yo, give me the resource with id = 1 yo, give me the resource with id = 2 yo, give me the resource with id = 3 yo, give me the resource with id = 4