Skip to content

RichardZhu123/shopifyBackendTest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MEAN Authentication App for Shopify Backend Dev Challenge

API for registering users with mongodb and authentication using a JWT (json web token). This app uses passport and passport-jwt and uses a JWT strategy

Version

1.0.0

Usage

npm install
npm start

API Usage

Field Description
id The item's unique id.
name Name of customer.
email Email of customer.
username Username of customer.
title Name of product.
price Price of product.
inventory_count Number of product in inventory.
excludeUnavailable Boolean describing whether unavailable inventory is to be excluded from search

All API calls must contain the following headers

Key Value
Content-Type application/json

All endpoints listed below contain the endpoint, a live endpoint on Heroku, and a sample call.

Add Product

POST /product/create       // Adds product to database

Live endpoint: https://shopifybackendtest.herokuapp.com/product/create

{
  "title": "testProduct",
  "price": 3,
  "inventory_count": 3
}

Fetch (Single) Product

POST /product/fetch       // Fetches product

Live endpoint: https://shopifybackendtest.herokuapp.com/product/fetch

{
	"title": "testProduct"
}

Fetch All Products

POST /product/fetchall       // Fetches all products

Live endpoint: https://shopifybackendtest.herokuapp.com/product/fetchall

{
	"excludeUnavailable": true
}

Purchase Product

POST /product/purchase       // Purchases product, decreasing inventory_count by 1

Live endpoint: https://shopifybackendtest.herokuapp.com/product/purchase

{
	"title": "testProduct"
}

View Cart

Fetch products contained in default user(username: test123)'s cart.

GET /product/viewCart       // Fetches cart

Live endpoint: https://shopifybackendtest.herokuapp.com/product/viewCart

{ }

Add to Cart

Adds item to cart, but the product stays in the inventory (inventory_count doesn't change)

POST /product/addToCart       // Adds item to cart

Live endpoint: https://shopifybackendtest.herokuapp.com/product/addToCart

{
	"title": "testProduct"
}

Checkout

Purchases all items in default user(username: test123)'s cart and empties the cart

POST /product/checkout       // Checkout of all items in cart

Live endpoint: https://shopifybackendtest.herokuapp.com/product/checkout

{ }

User Registration

POST /users/register       // Adds user to database

User Authentication

POST /users/authenticate   // Gives back a token

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published