DEV Community

Discussion on: What is GraphQL and how to use it

Collapse
 
cepheivv profile image
cepheiVV

In this tutorial you're testing the input/output by the Graphiql web UI.
How would I make the request from within the code, instead of the UI?

Collapse
 
adityasridhar profile image
Aditya Sridhar

You could send a HTTP POST request to the graphql server. For example using curl you can call the hello endpoint as follows

curl -X POST -H "Content-Type: application/json" -d "{\"query\": \"{ hello }\"}" http://localhost:5000/graphql

You can checkout the following url to know more about accessing the graphql endpoints from a client.

graphql.org/graphql-js/graphql-cli...