Before running the API, create a .env
file and place it in /config/
. Copy the content below into /config/.env
and change each value to match your credentials and database.
POSTGRES_USER=db-user
POSTGRES_PASSWORD=user-pwd
POSTGRES_DB=db-name
POSTGRES_URL=url
POSTGRES_PORT=5432
To build the API, run the command below in the root
directory (~/
).
go build -o bin/main ./cmd/main.go
or
make build
To run the API, run the command below in the cmd
directory (/cmd/
).
go run .
or run make run
in the root
directory (~/
).
To run the tests, run the command below in the tests
directory (/tests/
)
go test -v
Or run go test -v ./...
in the root directory (/
).
Or run make test
in the root directory (/
).
To setup the git hooks run the command below in the root
directory (~/
).
make setup-git-hooks