You need:
๐น Go v1.18+
๐ Docker v20.10.14+
๐ฆ docker-compose v1.28.2+
Package | Version | Type |
---|---|---|
gofiber/fiber | v2.31.0 | Core |
go-gorm/gorm | v1.23.3 | Database |
stretchr/testify | v1.7.0 | Test |
uber-go/zap | v1.21.0 | Logs |
google/uuid | v1.3.0 | Utils |
joho/godotenv | v1.4.0 | Config |
Run using:
docker-compose up
or run locally using:
go mod download -x && go mod verify
go run main.go
In order to run it locally is necessary to have a PostgreSQL instance running in your machine.
curl -X GET http://127.0.0.1:8080/hello-world
curl -X POST http://127.0.0.1:8080/pet \
-H 'Content-Type: application/json' \
-d '{"name":"Megan","kind":"Dog"}'
Example Output:
{"id":"56a7b854-1dca-415a-9259-9432c993b363","name":"Megan","kind":"Dog","created-at":"0001-01-01T00:00:00Z","updated-at":"2022-04-07T16:53:59.461711837Z","deleted-at":null}
curl -X GET http://127.0.0.1:8080/pet/7c7c62c67-473e-48f2-a7da-60f0c24f2b6b
Example Output:
{"id":"c7c62c67-473e-48f2-a7da-60f0c24f2b6b","name":"Onix","kind":"Cat","created-at":"0001-01-01T00:00:00Z","updated-at":"2022-04-07T16:51:25.01315Z","deleted-at":null}
Run test suite:
go test ./...