alexieyizhe / shopify-pie-api

The only API that pie lovers need. A submission for Shopify's Developer Intern Challenge.

Home Page:https://us-central1-shopify-dev-challenge-s19.cloudfunctions.net/mainAPI/products

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The Shopiefy API

An API for pie lovers. Also an API for any type of product, but let's be real - pies are the only thing worth querying for.

Motivation

This was created as part of the Shopify Developer Intern Challenge (Summer 2019), and is live at the following link!

API

Accessible at https://us-central1-shopify-dev-challenge-s19.cloudfunctions.net/mainAPI/ENDPOINT

Endpoints

  • πŸ₯§ Get all products: /products [GET]
    • Append the inStock=true query parameter to only see products that are in stock (ex. /products?inStock=true)
  • πŸ₯§ Find a single product by ID: /products/{productID} [GET]
  • πŸ₯§ Purchase a product /product/{productID}/purchase [PATCH]
    • This is disabled, you must add a product to a cart before you can purchase it by checking out with the cart
  • πŸ›’ Get a cart and its contents by ID: /cart/{cartID} [GET]
  • πŸ›’ Create a cart: /carts [POST]
  • πŸ›’ Add a product to a cart, both by ID: /cart/{cartID}/add/{productID} [PATCH]
  • πŸ›’ Remove a product from a cart, both by ID: /cart/{cartID}/remove/{productID} [PATCH]
  • πŸ›’ Checkout with a cart by ID: /cart/{cartID}/purchase [PATCH]

A Learning Experience

I was able to gain a deeper understanding of Promises and working in an async environment in general. I had never integrated Firebase with another framework (Express, in this case) before, so that was also a learning experience :D

Development

Setting up

  • Use git clone to clone this repository. Alternatively, download the source code.
  • Make sure you're in the functions/ folder by executing cd functions/.
  • Make sure required dependencies have been installed using npm install.

Development and testing

  • Execute:
    • npm run serve to create a local server running the site and more importantly, the API.
    • npm run shell to open up Firebase's shell for testing cloud functions.
    • npm run lint to run eslint on the project.

Building for production

  • Run firebase deploy to deploy the API and the site.

About

The only API that pie lovers need. A submission for Shopify's Developer Intern Challenge.

https://us-central1-shopify-dev-challenge-s19.cloudfunctions.net/mainAPI/products


Languages

Language:JavaScript 61.6%Language:HTML 38.4%