- API Implementation for a pizza-delivery company.
- RESTful JSON API that listens on ports 3000 and 3001 for testing and 5000 and 5001 for production.
- API allows you to:
- Create, edit and delete users (name, email address, street address)
- Create, edit and delete tokens
- Get pizza's information
- Create, edit and delete carts
- Make payments (orders) integrated with Stripe API
- Send confirmation Email integrated with Mailgun API
- User could login and logout creating and destroying a token
- Keep carts information. EG: present information about sales. Pizza array added to order. DONE (stored in order information)
- Create a worker to delete expired tokens
- Test automation
- Two validation levels of the email:
- Empty email field
- Existence Email validation have been done with trumail API (https://trumail.io/)
- git clone https://github.com/benjaoholeguy/PIZZA-DELIVERY-API.git
- cd your_path/PIZZA-DELIVERY-API
- node index.js
- node
- Stripe - https://stripe.com
- Mailgun - https://www.mailgun.com
- Trumail - https://trumail.io
- Retrieve data for an existing user as JSON.
- Required fields: (in queryStringObject object) {string}
email
, {numeric}pizzaId
- Return: Pizza object
- Requires Token: Yes
- Register a new json order in orders folder. Make the payment connecting with Stripe API. Delete json cart from carts folder after the payment. Send an email with the order's amount and id.
- Required: (in JSON payload) {string}
orderId
, {string}email
- Return: Order object. {string}
orderId
, {string}paymentId
, {numeric}amount
, {string}userEmail
, {Date}date
- Requires Token: Yes
- Register a new json cart in carts folder.
- Required: (in JSON payload) {Array}
pizzas
, {string}email
- Return: Cart object. {string}
cartId
, {Array}pizzas
, {string}userEmail
- Requires Token: Yes
- Retrieve data for an existing cart in JSON format.
- Required fields: (in queryStringObject object) {string}
id
- Return: Cart object
- Requires Token: Yes
- Update an existing cart.
- Required: (in JSON payload) {string}
id
, {Array}pizzas
- Return: Cart object
- Requires Token: Yes
- Delete an existing user.
- Required: (in JSON payload) {string}
id
- Return: {}
- Requires Token: Yes
- Create a new user. Each user must have a unique email address.
- Required: (in JSON payload) {string}
name
, {string}email
, {string}address
, {boolean}tosAgreement
- Return: User object
- Requires Token: No
- Retrieve data for an existing user as JSON.
- Required fields: (in queryStringObject object) {string}
email
- Return: User object
- Requires Token: Yes
- Update an existing user.
- Required: (in JSON payload)
email
- Optional: (in JSON payload)
name
,address
,tosAgreement
(at least one must be specified) - Return: User object
- Requires Token: Yes
- Delete an existing user.
- Required: (in JSON payload) {string}
email
- Return: {}
- Requires Token: Yes
- Create user token
- Required fields: (in JSON payload) {String}
email
- Return: {String}
email
, {String}id
, {number}expires
- Requires Token: No
- Lookup the token for a user.
- Required: (in queryStringObject object) {String}
id
- Return: {String}
email
, {String}id
, {number}expires
- Requires Token: No
- Extend a token for a user.
- Required: (in JSON payload) {string}
id
, {boolean}extend
- Return: {}
- Requires Token: Yes
- Remove user token
- Required fields: (in queryStringObject object) {string}
id
- Return: {}
- Requires Token: Yes
- node index.js run the application on port 3000 and 3001 (default)
- NODE_ENV=production node index.js run the application on ports 5000 & 5001
- NODE_DEBUG=/file to debug/ node index.js
- Example: NODE_DEBUG=handlers node index.js