A Node.js & MySQL digital storefront. This is a command line Node app that mimics an Amazon-like storefront.
This JavaScript file runs the basics of placing an order:
bamazonCustomer.js
(See example here)- Receives orders from customers via the command line and interfaces with mySQL to deplete stock from the store's inventory.
The JavaScript file mentioned above query a MySQL database called bamazon
Its locally hosted.
-
Please view the
schema.sql
file to see how the database was created using SQL queries. -
If you want to run this app on your own computer, please use the following commands:
- Run
CREATE DATABASE bamazon;
in mySQL. - Make sure to select the correct database by running the `USE bamazon;
- In
schema.sql
file refer to the SQL commands under the--Table
comment to set up theproducts
table. - In
schema.sql
file refer to the SQL commands under the--Input of items to database
comment to input theData
for the table.
- Run
Please note that this repo has two npm dependencies.
Before running the JavaScript file mentioned above, please run npm install
in your terminal to download the prompt and mysql node packages.
Below are screenshots that capture the app functionality.
- Run
node BamazonCustomer.js
in your terminal. This will pull data from MySQL and show all the products for sale.- The customer can then enter the product ID number of the item they wish to buy.
Once the customer enters the ID they can then enter the qty they wish to buy.
- If the inventory has enough stock, the order will then be processed.
- If there's not enough invenotry to fufill their order, the customer will then see a message with the current stock and be notified that their order is now canceled.
- The customer can then enter the product ID number of the item they wish to buy.
Once the customer enters the ID they can then enter the qty they wish to buy.
-
BamazonManager.js
- This will act as a warehouse management system. Which will allow a manager to view stock and adjust inventory in a few different ways.
-
BamazonExecutive.js
- This will offer insight into profit and sales from the bamazon store.