This is a ToDo MVC app with Go
- Air - Hot reloading
- GORM - ORM
- Fiber - Web framework
- GoDotEnv - Env variables
- Fiber template - HTML Template engine
Follow the steps below to set up the project.
create a new .env
file in the root directory and add the following:
PORT=8080
DB_URL="host=localhost user=gorm password=gorm dbname=gorm port=5432 sslmode=disable"
PORT
is the port where the API will run (default: 8080). You can change it if you want.
DB_URL
is the connection string for the database. Change it according to your database credentials.
Air is a tool for running Go applications in the background, refreshing whenever it is modified.
ps: You can change the .air.toml
file with your configs if you want.
With air
installed, run the following command:
air
Run the following command
go run ./cmd/main.go