The shopcarts service allows customers to make a collection of products that they want to purchase. It contains a reference to a product and the quantity the customer wants to buy. It also contains the price of the product at the time they placed it in the cart. A customer will only have one shopcart.
This project leverages Flask-RESTX to generate Swagger/OpenAPI documentation available at /apidocs.
These are the RESTful routes for shopcarts
and items
:
Endpoint Methods Rule
------------------ ------- -----------------------------------------------------
index_page GET /
shopcartsapi_page GET /shopcartsapi
itemsapi_page GET /itemsapi
health GET /health
apidocs GET /apidocs
list_shopcarts GET /api/shopcarts
create_shopcarts POST /api/shopcarts
get_shopcarts GET /api/shopcarts/<shopcart_id>
update_shopcarts PUT /api/shopcarts/<shopcart_id>
delete_shopcarts DELETE /api/shopcarts/<shopcart_id>
clear_shopcarts PUT /api/shopcarts/<shopcart_id>/clear
list_items GET /api/shopcarts/<shopcart_id>/items
create_items POST /api/shopcarts/<shopcart_id>/items
get_items GET /api/shopcarts/<shopcart_id>/items/<item_id>
update_items PUT /api/shopcarts/<shopcart_id>/items/<item_id>
delete_items DELETE /api/shopcarts/<shopcart_id>/items/<item_id>
The test cases can be run with green
.
-
Leveraging the Docker command to launch the PostgreSQL CLI in the shopcarts.db container using the following command:
docker exec -it shopcarts.db psql -U postgres -d postgres -h localhost -p 5432
Copyright (c) John Rofrano. All rights reserved.
Licensed under the Apache License. See LICENSE
This repository is part of the NYU masters class: CSCI-GA.2820-001 DevOps and Agile Methodologies created and taught by John Rofrano, Adjunct Instructor, NYU Courant Institute, Graduate Division, Computer Science, and NYU Stern School of Business.