https://github.com/koizumi7010/go-todo-api
This is a REST API for ToDo application using Gin and Gorm.
https://github.com/koizumi7010/go-todo-api
docker docker-compose golang mysql
Last synced: 4 months ago
JSON representation
This is a REST API for ToDo application using Gin and Gorm.
- Host: GitHub
- URL: https://github.com/koizumi7010/go-todo-api
- Owner: koizumi7010
- Created: 2024-06-15T11:17:42.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-15T11:27:01.000Z (about 2 years ago)
- Last Synced: 2025-02-11T17:14:07.852Z (over 1 year ago)
- Topics: docker, docker-compose, golang, mysql
- Language: Go
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-todo-api
This is a REST API for ToDo application using Gin and Gorm.
## Usage
### Run Server
```
$ git clone git@github.com:koizumi7010/go-todo-api.git
$ cd go-todo-api
$ docker-compose up -d
$ docker exec -d go-todo-api go run cmd/go-todo-api/main.go
```
### End points
| Method | Path | Description |
| ------------- | ------------- | ------------- |
| GET | /todo | Get all task list |
| GET | /todo/{id} | Get a task |
| POST | /todo | Create a new task |
| PUT | /todo/{id} | Update a task |
| DELETE | /todo/{id} | Delete a task |
### API call samples
```
# Get all task list
$ curl -i -XGET localhost/todo
# Get a task
$ curl -i -XGET localhost/todo/1
# Create a new task
$ curl -i localhost/todo -H "Content-Type: application/json" -X POST -d '{"task": "test1"}'
# Update a task
$ curl -i localhost/todo/1 -H "Content-Type: application/json" -X PUT -d '{"task": "test1","status": "done"}'
# Delete a task
$ curl -i localhost/todo/1 -X DELETE
```