This is a simple project to demonstrate how to create a GraphQL API using Go. It implements a todo list with basic CRUD functionality.
- Go 1.16 or higher
- github.com/99designs/gqlgen
- Clone the repository:
git clone https://github.com/53jk1/go-graphql-todo.git
- Install dependencies:
go mod download
- Start the server:
make run-dev
- Open your web browser and go to http://localhost:8080/playground to access the GraphQL Playground.
- Use the Playground to create, update, delete, and retrieve todos.
mutation {
createTodo(title: "Buy groceries", description: "Milk, eggs, bread") {
id
title
description
isCompleted
}
}
mutation {
updateTodo(
id: "1"
title: "Buy groceries"
description: "Milk, eggs, bread, cheese"
isCompleted: true
) {
id
title
description
isCompleted
}
}
mutation {
deleteTodo(id: "a219e689-5f2c-4066-92cf-1059e01fb1aa")
}
query {
todos {
id
title
description
isCompleted
}
}
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.