Todolist is a simple todo list API server,
allowing you to add, remove, and mark tasks as done.
This project is a simple endeavor to learn Go, following the blog post Build a Todolist API Server in Golang with modifications.
- Add a task
- Remove a task
- Mark a task as done
- List all tasks
- List all tasks that are done
- List all tasks that are not done
- Clone the repository and navigate to the directory
git clone https://github.com/Lai-YT/todolist
cd todolist
- Create a docker container for the MySQL database
./create-docker-container.sh
This will create a MySQL container named todolist-mysql
with a database named todolist
, serving on port 3306
.
The default username and password are root
and root
, respectively. The data files of the database are mounted to the ./data
directory.
Note
The execution of the script may fail with the following error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Run the script again, and it should work.
For later use, you can start the container with the following command:
docker start todolist-mysql
- Run the API server
go run todolist.go
There's also a frontend for this project, which was initially created by themaxsandelin, modified by sdil, and finally tailored by me. You can find it at Lai-YT/todolist-frontend.
The API server uses:
- MySQL as our database
- GORM as the ORM to interact with our database
- Request routing using gorilla/mux
- Logrus for logging
The tests use:
Todolist is licensed under the MIT license.