GithubHelp home page GithubHelp logo

adk-pizza-api's Introduction

aldyadk's Homework assignment #2

Repository of Pirple's Nodejs Masterclass Course

Requirements

NodeJS

API Definition

/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

/login

{
	"email": "[email protected]",
	"password": "Your password"

}

/logout

Requires token string in header,

token : xxxxxxxTOKENxxxxxxx

Note: it removes the token from the system itself.

/show-menu

Requires token string in header,

token : xxxxxxxTOKENxxxxxxx

Returns the list of possible pizza's to select,

/add-to-cart

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

/checkout-order

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.