English | 简体中文
Go-TODO provides a backend api of a shared TODO List app based on Golang and the
Gin
framework. It also supports quick deployment with Docker.
Major api functions:
- User register/login
- Create/Update/Done/Undone TODO events, and view list of all or by a specific user TODO tasks with paging function
- All TODO events are public, however, only the creator can make changes. It's supposed to encourage users by seeing friends' progresses.
- Dynamically updated user rankings (by task numbers and total amount of minutes). Rankings are reset at midnight everyday.
Online api docs: http://34.96.161.126/swagger/index.html
Online api demo:GET - http://34.96.161.126/api/v1/ranking/todos
Testing username
: user1
Testing password: 12345
- Language:Golang
- Backend:RESTful api built with Gin
- Database:
- Using
MySQL
(8.0.21) as the main databaes - Using
Redis
(6.2.6) for recording the daily rankings
- Using
- ORM:Using Gorm v2(1.22.5) to implement basic data manipulation and also data migration
- Cache:Using
Redis
to stroeJWT
tokens of active users,which supports further development on multipoint login, blacklists and so on - API Docs:Using Swagger to auto-generate API documentation
- Config:Using Viper to implement yaml configuration files
- Log:Using zap for logging
# Clone the repo
git clone https://github.com/nolanzzz/go-todo.git
cd go-todo
# Install dependencies
go generate
go build -o server main.go
# Run the binary executable and specify the config filename. Use config.yaml by default
./server -c config.yaml
This project includes a base Dockerfile
as well as a docker-compose
config file that includes MySQL
and Redis
services. Use Docker for quick deployment:
cd go-todo
docker-compose up
The repo includes the most recent docs. Re-generate when need to make changes:
cd go-todo
swag init
Open http://localhost:8080/swagger/index.html in a browser to check generated docs after starting up the app.