shopping-cart-go

License: GPL v3

Go Build

Quality gate

Sonar Scan & Test Coverage - Overall Summary

Tech

Build / Install

go build

Run Tests

go test -v

Run API App

go run main.go
OR
./shopping-cart-go

POST Request to Add Item 1

curl -X POST -H "Content-Type: application/json" -d '{"id":1,"name":"Laptop","price":999.99}' http://localhost:8080/add

{"id":1,"name":"Laptop","price":999.99}

POST Request to Add Item 2

curl -X POST -H "Content-Type: application/json" -d '{"id":2,"name":"basketball","price":77.99}' http://localhost:8080/add

{"id":2,"name":"basketball","price":77.99}

GET Items

curl http://localhost:8080/cart

[{"id":1,"name":"Laptop","price":999.99},{"id":2,"name":"basketball","price":77.99}]