Skip to content

salsanads/go-api-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go API Sample

A simple web API built using Go and PostgreSQL.

How to Run

  1. Install Dependencies
govendor sync
  1. Copy sample.env to .env
cp sample.env .env
  1. Install go-api-sample
go install
  1. Run go-api-sample
go-api-sample
  1. Access it at http://127.0.0.1:8080/products

How to Run inside Docker

  1. Install Dependencies
govendor sync
  1. Compile go-api-sample
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo cmd/api/main.go
  1. Build Image
docker build . -t salsanads/go-api-sample
  1. Run Image
docker run --net=host -d -p 8080:8080 salsanads/go-api-sample
  1. Access it on the host at http://127.0.0.1:8080/products

How to Run Test

  1. Install Dependencies
govendor sync
  1. Copy sample.env to .env
cp sample.env .env
  1. Run Test
go test -v

About

A simple web API built using Go and PostgreSQL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages