Skip to content

Example Todo app on top of json-graphql-server

Notifications You must be signed in to change notification settings

UtilLibs/todo-graphql-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

todo-graphql-example CircleCI

Start server with npm start. You can find GraphQL playground at http://localhost:3000

Example asking for all todos

query {
  allTodos {
    id,
    title,
    completed
  }
}

Response

{
  "data": {
    "allTodos": [
      {
        "id": "1",
        "title": "do something",
        "completed": false
      },
      {
        "id": "2",
        "title": "another",
        "completed": false
      }
    ]
  }
}

Example creating new todo object

mutation {
  createTodo(id: 2, title: "another", completed: false) {
    id
  }
}

Response

{
  "data": {
    "createTodo": {
      "id": "2"
    }
  }
}

Example asking for a single todo (notice id argument)

query {
  Todo(id: 2) {
    id,
    title,
    completed
  }
}

Response

{
  "data": {
    "Todo": {
      "id": "2",
      "title": "another",
      "completed": false
    }
  }
}

Development

Backend is json-graphql-server. Front-end React code is in src folder, modeled after Getting Started With React And GraphQL post.

About

Example Todo app on top of json-graphql-server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 97.6%
  • HTML 2.4%