A simple project to learn GraphQL
- Type inspection
- Query multiple DBs from one GraphQL server
- Flexibility of the queries
- Clone the project:
git clone git@github.com:Parissai/learn-graphql.git
- Install dependencies:
npm i
- Install MongoDB
- Create a directory for the data:
mkdir -p /data/db
OR if you don't have admin access: sudo mkdir -p /data/db
- Make sure that you have access to the directory you just created:
sudo chmod 777 /data/db
- Get MongoDB started with
mongod
in one terminal
- Run the server in another terminal:
npm start
mutation {
createContact(input: {
firstName: "Par",
lastName: "issa",
company: "FAC"
}) {
id
}
}
query {
getContacts {
id
firstName
lastName
company
}
}
mutation {
updateContact({input: {
id: "5c2bde3403cad61267d308ad"
firstName: "Parissa"
lastName: "S"
company: "Founders&Coders"
}}), {
firstName
lastName
company
}
}
mutation {
deleteContact(id: "5c2c0fb12e03c8543f4fe538")
}