/nodejs.graphql.basic.template

⚗ Basic template of a NodeJS application with GraphQL

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

nodejs.graphql.basic.template

Basic template of a NodeJS application with GraphQL

Run mongoDB docker container

docker run --name mongodb -d -p 27017:27017 mongo

Query examples

Getting a user by id

query {
  user(id: "61fff210196972b7cc1d3789") {
    name
    email
  }
}

Getting a list of users

query {
  users {
    id
    name
    email
  }
}

Mutations examples

Creating a user and returning the user's id

mutation {
  createUser(name: "Diogo", email: "diogo@mail.com") {
    id
  }
}