September 2018
Intermediate to advanced
398 pages
9h 43m
English
We define all of the URLs of our API in the config/routes file. In this file, we define the mapping between the URL and the code. In our example, the file looks as follows:
# Product API GET /v1/products W.listProduct POST /v1/products/add W.addProduct # Cart API GET /v1/cart/products W.listCartProducts() DELETE /v1/cart/products/:id W.deleteCartProduct(id) POST /v1/cart/products/:id/quantity/:qty W.addCartProduct(id,qty) PUT /v1/cart/products/:id/quantity/:qty W.updateCartProduct(id,qty)
For more clarity, we squeezed the controllers.WebServices package to W, to fit the page width.
For each line, if it starts with #, the line is a comment; otherwise, the first column defines the HTTP action to perform, followed by the ...
Read now
Unlock full access