This is a REST web server for hosting puppies, the available routes for this server are:
GET /api/puppy/{id}
POST /api/puppy/ Payload: Puppy JSON without ID
PUT /api/puppy/{id} Payload: Puppy JSON without ID
DELETE /api/puppy/{id}
go run ./pkg/cmd/puppy-server/main.go --data fileName.json
For any help with usage please use flag --help
--store
(long flag),-s
(short flag)
map
using native map structure (default option if not specified)sync
using sync.Map structure
--port
(long flag),-p
(short flag)
This server runs on a single endpoint of:
POST /api/lostpuppy/ Payload: { id: PUPPY_ID }
go run ./pkg/cmd/lostpuppy-service/main.go
First thing first, you must install go and golangci-lint:
- Install go 1.12
- Install golangci-lint
To build the project, run the following command while you are in the root of the project folder:
go build ./...
To test this project, follow the steps below:
- Run test cases:
go test ./...
- Lint it:
golangci-lint run
- Ensure 100% test coverage
go test -coverprofile=coverage.out ./... && go tool cover -html=coverage.out