I installed express from the command line with:
Next I modified the original server.js file I had created. Here I now have a new module which is 'express'. This will help me to be able to run a webserver and then will mount a GraphQL API server on the HTTP endpoint I have assigned of "/graphql" on my Ubuntu cloud virtual machine.
And now things are beginning to get more interesting. I now have a visual interface with which I can send queries to the API HTTP endpoint. So here when I send a query for '{ hello }' the contents of the variable within my function are returned in GraphQL syntax which works in a very similar manner to JSON. One additional note is that this data exists within an HTTP API endpoint so it can also just be called directly from the URL as:
http://'theSpecificIP':'thePortNumber'/graphql?query={hello}.
Using the GraphiQL interface to issue queries. |
No comments:
Post a Comment