An app that uses MySQL and node to create a Amazon-like storefront
- Clone this repository to your computer and install dependencies:
with SSH:
git clone [email protected]:tintdang/bamazon.git
go to the root of your bamazon folder
npm install
-
Set up your MySQL credentials. Either open
bamazon.sql
in your sql editor, and run the script. -
Run the app with one of the following commands. Usage for each is documented below:
node bamazonCustomer.js
node bamazonManager.js
node bamazonSupervisor.js
The bamazonCustomer.js
is intended for your customers. Your customers will run node bamazonCustomer.js
, the following will occur:
- A table of your current iventory will be printed, displaying product names, IDs, departments, prices, and stock.
- Customers will be prompted to enter the ID of the product they want to buy.
- Customers will be asked how many units they want to buy.
- Their total will be printed, and the inventory of the appropriate product will decrease. They may repeat this step until they complete their order. NOTE: if the customer wishes to buy more than what you have in stock, they will be alerted and taken back to the initial purchase prompt.
The bamazonManager.js
file provides an interface for store managers to view and modify inventory. The following commands are available:
View Products For Sale
: This command will print a table of your current inventory, allowing easy access to important information on your products.View Low Inventory
: Print your current inventory that are low on stock that is lower than 5.Add To Inventory
: Allows you to update your database when receiving more product.Add New Product
: Allows you to add more products to your inventory.Quit
: Will let you exit the application