This is a command line application developed to act as a digital store front. Upon execution, it will present the customer with a table of available products in the digital marketplace. The customer then select products based on their ID, specifies a quantity and is then presented with a total and in the process, the app updates the stores inventory to reflect the purchase. The following software is required to successfully execute the app:
- Unix command line
- Any Linux distro (e.g. Fedora, Ubuntu, Mint)
- mac OS
- Git Bash, cygwin or Bash on Ubuntu on Windows (WSL) should work on Windows
- Nodejs
- mysql-server
- inquirer (npm)
- mysql (npm)
- Clone the repo to your local computer. Change into the repo directory. Use the command
npm install
to install the required node packages,inquirer
andmysql
. Ensure all expected files are present withls
command.
- Ensure that sql scripts will function as expected.
- Enter the mysql command line interface using
mysql -u root -p
. Be sure to enter the password set up for root user of mysql.
- Create the database "Bamazon" and populate a table with entries using these commands:
SOURCE Bamazon.sql;
(creates database and table)
SOURCE 10products.sql;
(populates table with 10 products)
- Check that table exists using the command
SELECT * FROM products
-
Exit mysql command line with
CTRL + D
. -
Use nodejs to execute the
bamazonCustomer.js
file. The store directory will be presented as an array of objects. The relevant command isnode bamazonCustomer.js
.
- Continue through the prompts. At the last prompt, the customer is presented with the total price and the inventory is updated accordingly.
- Note that the program will not proceed if an invalid ID is entered or there is insufficient stock.