GithubHelp home page GithubHelp logo

joeburton / apollo-3-mongoose-integration Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 90 KB

Experimenting with connecting Apollo Server 3 with MongoDB using Mongoose.

Home Page: apollo-3-mongoose-integration.vercel.app

TypeScript 39.09% JavaScript 60.91%

apollo-3-mongoose-integration's Introduction

apollo-3-mongoose-integration

#Live

curl --request POST \
  --header 'content-type: application/json' \
  --url 'https://apollo-3-mongoose-integration.vercel.app/graphql' \
  --data '{"query":"{\n    getTodos {id, title, detail, complete, date}\n}","variables":{}}'

#Local

curl --request POST \
  --header 'content-type: application/json' \
  --url 'http://localhost:4000/graphql' \
  --data '{"query":"{\n    getTodos {id, title, detail, complete, date}\n}","variables":{}}'

Get Todo

query GetTodo {
  getTodo(id: "62262b1d221387163eacaba5") {
    id
    listName
    title
    detail
    complete
    date
  }
}

Get Todos

query GetTodos {
  getTodos {
    id
    listName
    title
    detail
    complete
    date
  }
}

Add Todo with inline variables

mutation AddTodo {
  addTodo(
    title: "create id"
    listName: "tech"
    detail: "first detail first detail first detail"
    date: "2021-03-07"
    complete: true
  ) {
    id
    listName
    title
    detail
    complete
    date
  }
}

Add Todo with payload

mutation AddTodo($listName: String, $title: String, $detail: String, $complete: Boolean, $date: Date) {
  addTodo(listName: $listName, title: $title, detail: $detail, complete: $complete, date: $date) {
    id
    listName
    title
    detail
    complete
    date
  }
}

// Payload
{
  "title": "Build AWS pipeline",
  "listName": "tech",
  "detail": "Build AWS pipeline",
  "complete": false,
  "date": 1645660800000
}

Update Todo with inline variables

mutation UpdateTodo {
  updateTodo(id: "620e7406ae4bd45177b85391", title: "This2 is a new titl22e2") {
    id
    title
  }
}

Update Todo with payload

mutation UpdateTodo($id: ID, $listName: String, $title: String, $detail: String, $complete: Boolean, $date: Date) {
  updateTodo(id: $id, listName: $listName, title: $title, detail: $detail, complete: $complete, date: $date) {
    id
    listName
    title
    detail
    complete
    date
  }
}

// Payload
{
  "id": "622b19beef69ae3c2c02a9c7",
  "listName": "general",
  "title": "Fix toilet pan",
  "detail": "not much",
  "complete": true,
  "date": 1645660800000
}

Delete Todo

mutation DeleteTodo {
  deleteTodo(id:"620e73faae4bd45177b8538f")
}

Delete Many

mutation DeleteBulk {
  deleteBulk(title: "the title")
}

apollo-3-mongoose-integration's People

Contributors

joeburton avatar

Watchers

 avatar

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.