Install go-migrate for running migration
https://github.com/golang-migrate/migrate
App requires 2 database (postgreSQL and redis server), run from your local machine or run it using docker with the following command
# run postgreSQL
docker run -d -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=go-boilerplate postgres
# run redis
docker run -d -p 6379:6379 redis
Run below command to run migration
migrate -path migration -database "${DATABASE_URL}" up
To create a new migration file
migrate create -ext sql -dir migration -seq name
Run below command to run test, and make sure that all tests are passing
go test -v ./...
Run below command to run app
go run ./cmd/api/main.go
You can find usefull commands in Makefile
.