![]() you are trying to send a POST request with a GraphQL Query for a body?.you are trying to visit there in a browser and see something, or.When you say you are trying to access localhost:3000/graphql, do you mean: It might help to break down the expected behavior. Hi Jose-Xu, no problem at all on the late reply! :) Let's run a similar query, but with a fewer fields: Woo! Our data's all nice and organized-and it's exactly and ONLY what we requested! Then send it off, and see what it returns: Go ahead and add the code from the query above. In the top-left corner of the request text editor, make sure the the POST request's format is set to "GraphQL Query". Run $ rails s to start the Rails API server at Open Insomnia, and create a new POST request. Let's get this Query into Insomnia and test our API! The paymentsCount field will run the payments_count method on Types::OrderType, and return the appropriate value. The fields available are the ones we defined in app/graphql/types/payment_type.rb. Query field, we also have to define the fields from Types::PaymentType that we want to receive. Inside the class QueryType declaration, we'll add a field that returns an array of Types::OrderType: Our first Query will simply be to retrieve all Orders in the database. ![]() Like with the Types above, we will define possible Query methods through fields. When GraphQL receives a Query request (as opposed to a Mutation request), it will be routed to the QueryType class. We're almost ready to write that first Query, but first, we need to tell the main QueryType to expect it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |