Hello, welcome to Bamazon! This CLI (Command-line-interface) program acts as an online store-front that allows the user (customer) to purchase items from Bamazon's database. The app takes in orders from customers and depletes stock from the store's inventory.
Bamazon is built with Node.js and MySQL. The application is purely backend and uses a MySQL database.
Node Packages Used: inquirer, mysql, colors
- Download the appropriate npm packages by running npm install.
- Create a MySQL database and use the bamazon.sql seeds to create a table with usable data.
- Make sure you enter your database name and database password in the bamazonCustomer.js and bamazonManager.js files.
- Begin Customer Mode by running the following command in the terminal/commandprompt:
node bamazonCustomer.js
- In Customer Mode, a user has the ability to view the store's inventory and purchase items.
-
Select whether or not you want to view the store's inventory.
- Make sure you use the arrow keys and then space bar, then enter to select your choice.
- You will then see an object with Bamazon's inventory. Look for the item_id.
- You can also check to make sure the object matches up with the information from your database table using a GUI of your choice such as MySQLWorkbench.
- Enter the item_id as a number(ex. 6) when prompted.
- Enter the quantity of the item you want to buy as a number(ex. 100).
-
If the item is in stock, you will see a message notifying you that the item is in stock.
- Select yes if you would like to proceed with the purchase.
-
Note that this purchase is reflected in our database table. Here, the stock-quantity decreased.
- If the item is not in stock, you will be notified and asked if you want to continue shopping.
- After you've made your purchase, you will be notified how much you spent.
- You will then be asked if you would like to make another purchase.
- Select yes to be redirected to Bamazon's inventory.
- Begin Manager Mode by running the following command in the terminal/commandprompt:
node bamazonManager.js
- In Manager Mode, a user has the ability to do the following:
- Selecting this will list every available item: the item IDs, names, prices, and quantities.
- Selecting this will display all items with an inventory count lower than five.
- Selecting this will allow the user to add stock to any item that currently exists in the store's inventory.
- The user will then be prompted to answer the following questions:
- Selecting this will allow the user to add an entirely new product to the store's inventory.
- The user will then be prompted to answer the following questions:
Thank you for using Bamazon Store Front! Please contact me directly if you have any questions.