The Node-GraphQL-module is wrapping an existing Node-REST-API module.
Both Node-GraphQL-module and Node-REST-API are using ES6
.
To begin installation, go to directory of package.json
each module.
- cd to Node-GraphQL-module
cd graphql-restwrapper
then runnpm install
- move directory to Node-REST-API
cd graphql-restwrapper/app-server
and then again runnpm install
- Inside directory
graphql-restwrapper/app-server
run the node server usingnpm start
- Open up new terminal and go to directory Node-GraphQL-module
cd graphql-restwrapper
then runnpm start
After this operation, you have had two terminal opened running on port 5000
and 5001
.
Since The Node-GraphQL server running on localhost:5001
, hit localhost:5001/graphiql
to open Graphiql
client.
{
person(id: "1") {
firstName
lastName
userName
id
friends {
firstName
lastName
}
}
}
here are the response
{
"data": {
"person": {
"firstName": "Mark",
"lastName": "Zuckerberg",
"userName": "mark1",
"id": "1",
"friends": [
{
"firstName": "Sophia",
"lastName": "Latchuba"
},
{
"firstName": "Mark",
"lastName": "Zuckerberg"
}
]
}
}
}