Skip to content

Timeline API to practice and learn GraphQL concepts using Apollo Server, MongoDB and Typescript

License

Notifications You must be signed in to change notification settings

gabrielferreiraa/apollogram-server

Repository files navigation



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: "[email protected]"
    ) {
        id
        name
        email
    }
}

getAllPosts

query {
    getAllPosts {
        id
        title
        content
        user {
            name
            email
        }
    }
}

Mutations ✏️

Simple documentation to see mutation structures

Auth

mutation {
    Auth(
        email: "[email protected]"
        password: "1234"
    ) {
        token
        error
    }
}

CreateUser

mutation {
    CreateUser(
        name: "Raul Gil",
        email: "[email protected]",
        password: "1234"
    ) {
        id
        name
        email
    }
}

UpdateUser

mutation {
    UpdateUser(
        name: "Raul Gil - Edited",
        email: "[email protected]"
    ) {
        name
        email
    }
}

CreatePost

mutation {
    CreatePost(
        title: "Post Title"
        content: "Post Content"
    ) {
        title
        content
        user {
            name
            email
        }
    }
}

License

MIT