mirror of
https://github.com/raseels-repos/golang-saas-starter-kit.git
synced 2025-06-06 23:46:29 +02:00
SaaS Web API
Copyright 2019, Geeks Accelerator
accelerator@geeksinthewoods.com.com
Description
Service exposes a JSON api.
Local Installation
Build
go build .
Docker
To build using the docker file, need to be in the project root directory. Dockerfile
references go.mod in root directory.
docker build -f cmd/web-api/Dockerfile -t saas-web-api .
API Documentation
Documentation is generated using swag
Download swag by using:
go get -u github.com/swaggo/swag/cmd/swag
Run swag init
in the service's root folder which contains the main.go file. This will parse your comments and generate the required files (docs folder and docs/docs.go).
swag init
Trouble shooting
If you run into errors running swag init
try the following:
cannot find package
Try to install the packages to your $GOPATH.
GO111MODULE=off go get github.com/leodido/go-urn
GO111MODULE=off go get github.com/lib/pq/oid
GO111MODULE=off go get github.com/lib/pq/scram
GO111MODULE=off go get github.com/tinylib/msgp/msgp
GO111MODULE=off go get gopkg.in/DataDog/dd-trace-go.v1/ddtrace
error writing go.mod
Need to update pkg directory permissions.
Full error:
error writing go.mod: open /Users/leebrown/go/pkg/mod/github.com/lib/pq@v1.1.1/go.mod691440060.tmp: permission denied
Ensure the pkg
directory used for go module cache has the correct permissions.
sudo chown -R $(whoami):staff ${HOME}/go/pkg
sudo chmod -R 755 ${HOME}/go/pkg