Skip to content

kbakdev/go-graphql-todo

Repository files navigation

GraphQL Todo List

This is a simple project to demonstrate how to create a GraphQL API using Go. It implements a todo list with basic CRUD functionality.

Requirements

  • Go 1.16 or higher
  • github.com/99designs/gqlgen

Installation

  1. Clone the repository:
git clone https://github.com/53jk1/go-graphql-todo.git
  1. Install dependencies:
go mod download

Usage

  1. Start the server:
make run-dev
  1. Open your web browser and go to http://localhost:8080/playground to access the GraphQL Playground.
  2. Use the Playground to create, update, delete, and retrieve todos.

Example queries

Create a new todo

mutation {
    createTodo(title: "Buy groceries", description: "Milk, eggs, bread") {
        id
        title
        description
        isCompleted
    }
}

Update a todo

mutation {
    updateTodo(
        id: "1"
        title: "Buy groceries"
        description: "Milk, eggs, bread, cheese"
        isCompleted: true
    ) {
        id
        title
        description
        isCompleted
    }
}

Delete a todo

mutation {
    deleteTodo(id: "a219e689-5f2c-4066-92cf-1059e01fb1aa")
}

Retrieve all todos

query {
    todos {
        id
        title
        description
        isCompleted
    }
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published