Repository of Pirple's Nodejs Masterclass Course
[POST] http://localhost:3000/users
Example payload request:
{
"fullName": "Full Name",
"email": "[email protected]",
"address": "your address",
"password": "your password"
}
Requires token string in header,
token : xxxxxxxTOKENxxxxxxx
The required id in querystring is the hashed email address
Requires token string in header,
token : xxxxxxxTOKENxxxxxxx
{
"id": "xxxxxxxxxHASHEDEMAILADDRESSxxxxxxxxx", //required field
"fullName":"New Name", //optional
"address":"New Address", //optional
"password":"New Password" //optional
}
Requires token string in header,
token : xxxxxxxTOKENxxxxxxx
[POST] http://localhost:3000/login
{
"email": "[email protected]",
"password": "Your password"
}
[POST] http://localhost:3000/logout
Requires token string in header,
token : xxxxxxxTOKENxxxxxxx
Note: it removes the token from the system itself.
Requires token string in header,
token : xxxxxxxTOKENxxxxxxx
Returns the list of possible pizza's to select,
Requires token string in header,
token : xxxxxxxTOKENxxxxxxx
{
"items":["veggieGarden","superSupreme"]
}
Note: items should be an array of valid pizza names from the list of menu items. It allows multiple to add multiple pizzas with same name to the cart. After adding the shoppingcart array of the user object is updated.
Valid names: veggieGarden, meatLovers, splitza, superSupreme, pepperoniJalapeno, tunaMelt, hawaiianChicken
Requires token string in header,
token : xxxxxxxTOKENxxxxxxx
Also requires the following data on body (json), the id of the order to checkout and the stripe token to apply the charge (in this case it's a test token)
{
"paymentToken": "tok_visa"
}
Note: it creates a new order with all the items on user's cart and save it on the system, using the data folder called 'orders', the total price of the order is also calculated based on each price of pizza on the order. After placing the order, the cart gets empty, and send receipt email to the user.