A simple Express.js and GraphQL server with recipes.
First, clone the repository.
git clone https://github.com/SultanBadri/simple-express-graphql-server.git
Now run these commands to start the GraphQL server at http://localhost:4000/graphql.
cd simple-express-graphql-server
npm install
node index.js
{
recipes {
id
title
description
instructions
cookTime
ingredients
}
}
{
recipe(id : 1) {
id
title
description
instructions
cookTime
ingredients
}
}
query getRecipe($recipeId: ID!) {
recipe(id: $recipeId) {
id
title
description
instructions
cookTime
ingredients
}
}
NOTE: Make sure to declare a variable $recipleId
in the Query Variables panel of GraphiQL.
{
"recipeId": 3
}