Simple basket micro-service
For running the project, you need to install docker and docker-compose. Then simply run the following script:
./buildAndRun.sh
This will first run the build process, which includes building a docker image, and then boot up both a MariaDB database for persistance, and the application itself.
Currently there is no way to add a new basket, except in the import SQL script. That being said, the application boots up with 10 baskets, and for those you can do the following:
curl -X POST "http://localhost:8080/basket/{basketId}?productId={productId}&quantity={quantity}"
This will add {quantity} number of the product with product id {productId} into the basket with id {basketId}.
curl -X DELETE "http://localhost:8080/basket/{basketId}?productId={productId}&quantity={quantity}"
This will remove {quantity} number of the product with product id {productId} from the basket with id {basketId}.
curl -X GET "http://localhost:8080/basket/{basketId}"
This will list all the quantities of all the products within the basket with id {basketId}.
You can use either the add or remove methods to change the quantity of a product within the basket.