Skip to content

An Amazon-like storefront using MySQL and Node, specializing in products celebrating the 2018 NBA Playoffs.

Notifications You must be signed in to change notification settings

AceKingQueen/Bamazon-NBA-Playoffs-Edition

Repository files navigation

Bamazon-NBA-Playoffs-Edition

I've created an Amazon-like storefront using MySQL and Node, specializing in products celebrating the 2018 NBA Playoffs.

The app takes in orders from customers, checks to see if there is enough product in stock, depletes from the store inventory, and lastly, displays how much the order will cost. This application runs entirely through a computer's command line or terminal.

1) Initialize Node

To run the application locally, please initialize node from your terminal or command line: npm init

2) Create the Database

Then, copy and paste the code in bamazonSeeds.sql file into your favorite MySQL GUI tool.

PC users might want MySQL Workbench. Mac users might like Sequel Pro.

This will create the MySQL database (picture the MySQL database as a big Excel spreadsheet).

create database

3) Create the Table

Now, we need to create the table which will hold our product inventory, and fill it with each product for sale. A MySQL table is a bit like a tab or sheet on an Excel spreadsheet. Do this by copying and pasting the code in bamazonSchema.sql.

create table

4) Time to Shop!

Now, it's time to see the products available. To do this, make sure you're in the Bamazon application folder, and run bamazonCustomer.js: node bamazonCustomer.js

which item

The store's inventory will display in a table, followed by the prompt Which item would you like? Type the item ID and hit enter. Perhaps you're a Houston Rockets fan and want some Beard Oil as a keepsake from this year's playoff's run?

harden

Enter the correct Item ID (in this case, 7) followed by the quantity desired. You will then be given a total cost for your order. Refreshing the MySQL table will show the change in store inventory in the fifth column, stock_quantity.

before order after order

5) Sold Out?

But, you are not alone in loving the NBA. What happens if our NBA Playoffs store is out of that product?

There are only 5 customized Joel Embiid jerseys, for instance. What happens if you try to order one for everybody on your Rec League team (because they are AWESOME)?

embiid

You’ll learn the store is sold out of the product.

You will have the choice to either keep shopping or to stop shopping. Entering 'yes' will start the shopping process over again, revealing the store inventory in a table and asking which item you'd like.

sold out

Entering 'no' prompts a simple "have a nice day". Thank you for visiting my application!

have a nice day

About

An Amazon-like storefront using MySQL and Node, specializing in products celebrating the 2018 NBA Playoffs.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published