The todo-api project is a simple todoapp REST-API build using go programming language, gin - a go backend framework, GORM - a go database ORM, and docker. The aim of this project creation is for helping myself in order to understanding about go programming and it's implementation to backend system. You can also visit my frontend repository dedicated for complementing this project.
Before installing this project, you should know about the project requirements. Here are the requirements that you need to prepared:
- Go Programming Laguage
- Knowledge about Go.
- Knowledge about REST-API
This project is build using some third parties or dependencies. Here are the required dependencies:
- Gin (https://gin-gonic.com/)
- Gorm (https://gorm.io/)
- Go dotenv (https://github.com/joho/godotenv)
- CompileDaemon (https://github.com/githubnemo/CompileDaemon)
- MySQL driver (https://gorm.io/docs/connecting_to_the_database.html)
In this project, we only use a single migration, because the table is very simple - only consists of one database table named tasks. Before we step to the migration, you have to make a database called todo in your XAMPP.
After that, you can run the database migration by the following command:
go run migrations/migrate.task.go
To run the project, you can use a usual go command:
go run main.go
But, in this project we are not going to use it. Instead of using go run
command, we will using CompileDaemon to run our application. Here is the command to run our application using CompileDaemon:
CompileDaemon -command="./todo-api"
docker compose up