GithubHelp home page GithubHelp logo

matheustanaka / challengegraphql Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 1009 KB

CRUD using Graphql, Apollo server and Mongodb.

JavaScript 100.00%
graphql mongodb database apollo-server nodejs

challengegraphql's Introduction

Challenge Graphql

CRUD using graphql, apollo server and mongodb.

Getting Started


# MongoDB
- You have to create a database or just use your database in Docker (only MongoDB).

# install dependencies
$ yarn install

# start project
$ yarn dev

# see graphql interface on localhost link
http://localhost:4001/graphql

Queries


  • Create User

      mutation {
          createUser(data: {
              firstName: "Matheus",
              lastName: "Tanaka",
              email: " [email protected]"
              active: true
          }) {
              _id
              firstName
              lastName
              email
          }
      }
    
  • Query User

      query {
          users {
              _id
              firstName
              lastName
              fullName
              email
              active
          }
      }
    
  • Delete User

      mutation{
          deleteUser(id: "60b9753dcf587036e0008644")
      }
    
  • Update User

      mutation {
          updateUser (id: "60b9753dcf587036e0008644", data: {
              firstName: "Matheus3333",
              lastName: "Tanaka",
              email: "[email protected]"
              active: true
          }) {
              _id
              firstName
              lastName
              email
          }
      }
    
  • Create Post

      mutation {
          createPost(data:{
              title: "Testing 2 other poster",
              content: "testing",
              author: "60b9753dcf587036e0008644"
          }) {
              _id
              title
              content
              author{
              fullName
              _id
              }
          }
      }
    
  • Query Post

      query {
          posts {
              _id
              title
              content
              author {
              fullName
              }
          }
      }
    
  • Delete Post

      mutation {
          deletePost(id: "60b97f8694a07035382d075d")
      }
    
  • Update Post

      mutation {
          updatePost(id: "60b97ff238ad2b1444c36f97", data:{
              title: "Updating my second post",
              content: "testing",
              author: "60b9753dcf587036e0008644"
          }) {
              _id
              title
              content
              author{
              _id
              fullName
              }
          }
      }
    

challengegraphql's People

Contributors

dependabot[bot] avatar matheustanaka avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

challengegraphql's Issues

improving server to make it more robust

First, congrats, it is really cool project! Share it with the community.

We can improve it and make it more robust, always.

To get this I will leave some topics where you can improve your server:

Remember, you can ask for help at any time.

Keep growing!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.