A GraphQL server written in NodeJS
- NodeJS
- MongoDB (we need a URI so you can install Mongo in local or remote)
-
cp .env.example .env
(and edit as needed, insert the Mongo URI) -
yarn
-
yarn import-data
-
yarn start
-
Navigate to: localhost:8888/graphql
go here: graphiql
mutation create($input: CreateRecipeInput!) {
createRecipe(input: $input) {
id
title
body
}
}
---Params---
{
"input": {
"title": "Title created",
"body": "Body created"
}
}
query read($id: ID!) {
recipeById(id: $id) {
title
body
}
}
---Params---
{
"id": "591987bfb2c2a737588dcfc1"
}
mutation update($input: UpdateRecipeInput!) {
updateRecipe(input: $input) {
title
body
}
}
---Params---
{
"input": {
"id": "591987bfb2c2a737588dcfc1",
"title": "Title edited",
"body": "Body edited"
}
}
mutation delete($input: DeleteRecipeInput!) {
deleteRecipe(input: $input) {
message
}
}
---Params---
{
"input": {
"id": "591987bfb2c2a737588dcfc1"
}
}