The api is running at : https://twfapi.herokuapp.com/
In order to get the result from the api, one need to make a POST request to https://twfapi.herokuapp.com/order. The format of the request body will be a json object with an array named order that has details of the products ordered. For example, if an order consists of a "A" product, 2 "D" products and 2 "G" products. So request body will look like:
{
"order" : [
{ "name": "A", "qty": 1, "weight": 3 },
{ "name": "D", "qty": 2, "weight": 12 },
{ "name": "G", "qty": 2, "weight": 0.5 }]
}
(give weights in number of kg)
I have used postman to make a POST request to the api.
The response is as follows:
-
In order to run the code on local machine, clone the repo, install the dependencies and run
npm start
in the root directory of the repo. -
The api will take requests on localhost:3000.
-
Make a POST request to localhost:3000/order to get the result in the above explained format.