Giter VIP home page Giter VIP logo

pizza-delivery-api's Introduction

Pizza Delivery API (Node.JS)

Rest API for a Pizza Delivery company written in plain Node.JS. No NPM modules or external libraries.

Specs

  1. New users can be created, their information can be edited, and they can be deleted. We store their name, email address, and street address.

  2. Users can log in and log out by creating or destroying a token.

  3. When a user is logged in, they are able to GET all the possible menu items.

  4. A logged-in user is able to fill a shopping cart with menu items

  5. A logged-in user is able to create an order. Integrated with the Sandbox of Stripe.com to accept their payment.

  6. When an order is placed, automatically email the user a receipt. Integrated with the sandbox of Mailgun.com for this.


REST Endpoints

/users

POST
  • Create a new user. Each user must have a unique email address.
    Required fields: (in JSON payload) firstName, lastName, email, password, streetAddress, city, state, zipCode, tosAgreement Requires Token: No
GET
  • Retrieve data for an existing user as JSON.
    Required fields: (in query string) email
    Requires Token: Yes
PUT
  • Update an existing user.
    Required fields: (in JSON payload) email
    Optional fields: (in JSON payload) firstName, lastName, password, streetAddress, city, state, zipCode (at least one must be specified)
    Requires Token: Yes
DELETE
  • Delete an existing user.
    Required fields: (in JSON payload) email
    Requires Token: Yes

/tokens

POST
  • Create a token for a user. (log in)
    Required fields: (in JSON payload) email, password
    Requires Token: No
GET
  • Lookup the token for a user.
    Required fields: (in query string) id
    Requires Token: No
PUT
  • Extend a token for a user.
    Required fields: (in JSON payload) email, extend
    Requires Token: Yes
DELETE
  • Remove a token for a user. (log out)
    Required fields: (in query string) id
    Requires Token: Yes

/menu

GET
  • Get pizza menu. Returns a JSON object containing menu information.
    Required fields: None
    Requires Token: No

/cart

POST
  • Add a menu item to the user's cart.
    Required fields: (in JSON payload) email, itemName, size
    Requires Token: Yes
GET
  • Fetch the cart of the user. Returns a JSON object containing cart information. Required fields: (in query string) email Requires Token: Yes
PUT
  • Update the cart of the user.
    Required fields: (in JSON payload) email, cartItemId
    Requires Token: Yes
DELETE
  • Delete either one specific item or all items in the cart of the user. Required fields: (in JSON payload) email
    Optional fields: cartItemId (if not included all items in cart removed)
    Requires Token: Yes

/orders

POST
  • Generate an order for the user using their current cart contents and account information on file. Card is charged using a HTTPS request to Stripe API & confirmation email is sent using a HTTPS request to Mailgun API
    Required fields: (in query string) email
    Requires Token: Yes

pizza-delivery-api's People

Contributors

rashidarmand avatar

Forkers

benjaoholeguy

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.