Project to practice and learn GraphQL concepts
Demo 👉 https://graphql-timeline-api.herokuapp.com/playground
What are we using?
- Apollo Server
- GraphQL
- MongoDB with Mongoose
Getting Started
# clone repo
$ git clone https://github.com/gabrielferreiraa/timeline-graphql-api.git
$ cd timeline-graphql-api
# install dependencies
$ yarn
# start project
$ yarn start
See graphql interface on localhost link: http://localhost:9000/playground
TODO 📝
-
UpdatePost
- mutation -
DeletePost
- mutation -
DeleteUser
- mutation -
getPostById
- query - GraphQL improviments
- add tests
Queries 🔎
Simple documentation to see query structures
getAllUsers
query {
getAllUsers {
id
name
email
}
}
getUserByEmail
query {
getUserByEmail(
email: "user@email.com"
) {
id
name
email
}
}
getAllPosts
query {
getAllPosts {
id
title
content
user {
name
email
}
}
}
Mutations ✏️
Simple documentation to see mutation structures
Auth
mutation {
Auth(
email: "user@email.com"
password: "1234"
) {
token
error
}
}
CreateUser
mutation {
CreateUser(
name: "Raul Gil",
email: "raul@email.com",
password: "1234"
) {
id
name
email
}
}
UpdateUser
mutation {
UpdateUser(
name: "Raul Gil - Edited",
email: "raul-edited@email.com"
) {
name
email
}
}
CreatePost
mutation {
CreatePost(
title: "Post Title"
content: "Post Content"
) {
title
content
user {
name
email
}
}
}