In the previous chapter, we implemented the app using a local storage, and now we want to implement a server in Swift to handle the products and the cart.
The actions that we want to handle are as follows:
Getting the list of the products
Adding a product to the cart
Removing a product from the cart
Creating and ordering from the cart
Using the REST architectural paradigm, we design our server to handle the following actions:
HTTP GET of the
/products
URL, which returns the JSON of the product in the exact format we used in the previous chapterHTTP POST of the
/customer/<useremail>/cart/<productID>
URL, which creates a new relationship between the cart of the user and the productHTTP DELETE of the
/customer/<useremail>/cart/<productID>
URL, which removes the relationship between the cart of the user and the productHTTP POST of the
/customer/<useremail>/orders
URL, which creates a new order based on the customer's cart and resets...