order-pack ...
- write instructions
order-pack developed by using only standard library.
- write instructions
git clone git@github.com:murat/order-pack.git && cd order-pack
go build -o ./bin/order-pack ./cmd/main.go # or make build
go run cmd/main.go
# or
./bin/order-packgit clone git@github.com:murat/order-pack.git && cd order-pack
docker build . -t order-pack
docker run -p 8080:8080 order-packorder-pack is going to start a http server that listens 8080 port.
# Create product packs
http --form POST :8080/products name=100 size=100 && \
http --form POST :8080/products name=250 size=250 && \
http --form POST :8080/products name=500 size=500 && \
http --form POST :8080/products name=1000 size=1000 && \
http --form POST :8080/products name=2000 size=2000 && \
http --form POST :8080/products name=5000 size=5000
# Create order
# Will not save order to db
echo -n '{"item_count":501}' | http POST :8080/orders
## Resp:
{
"data": {
"CreatedAt": "0001-01-01T00:00:00Z",
"ID": 0,
"UpdatedAt": "0001-01-01T00:00:00Z",
"item_count": 501,
"items": [
{
"count": 1,
"product": {
"CreatedAt": "2023-10-15T15:32:41.57313+03:00",
"ID": 3,
"UpdatedAt": "2023-10-15T15:32:41.57313+03:00",
"name": "500",
"package_size": 500
}
},
{
"count": 1,
"product": {
"CreatedAt": "2023-10-15T15:32:40.837342+03:00",
"ID": 1,
"UpdatedAt": "2023-10-15T15:32:40.837342+03:00",
"name": "100",
"package_size": 100
}
}
]
}
}
- write specs
All PR’s and issues are welcome!