Skip to content

jamey-schaap/bookstore-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Golang 1.18 & Gin Bookstore API

Setup

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

Building

To build the API, run the command below in the root directory (~/).
go build -o bin/main ./cmd/main.go or
make build

Running

To run the API, run the command below in the cmd directory (/cmd/).
go run . or run make run in the root directory (~/).

Testing

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 (/).

Setting up git hooks

To setup the git hooks run the command below in the root directory (~/).
make setup-git-hooks