Git Product home page Git Product logo

bamazon's Introduction

Bamazon

Imagine for a moment that Jeff Bezos was so forward thinking that he conceptualized and created Amazon in 1977 (when he was 13), what would it look like? Enter Bamazon, the 1977 equivalent of Amazon. Bamazon runs on the command line and allows you to shop through an inventory of products as a customer and as a manager allows you to update inventory as needed.

How to Use

1. Download/Clone

Bamazon can be used by first downloading or cloning this repo to your machine.

2. Packages

Next within your /bamazon directory run npm install in your terminal. This will install all dependencies.

3. Database

Bamazon does require a MySQL database to work, more info about MySQL can be found here.

3.1

Once you have MySQL running on you machine you can create your database by running the SQL included in productScheme.sql in MySQLWorkbench or a similar tool.

3.2

You should now have a database called bamazon with five columns in it, and ten products if you chose to add the products. Now you will need to connect your database by enter the proper info into custom_modules/connection.js. Enter the proper port, user and password for your setup.

4. Running Bamazon

If you've properly completed the above steps you can now navigate to your /bamazon directory within your command line and run node bamazonCustomer.js. You will now see a list of the products listed in your database. If you want to change your products or updated your products you can run node bamazonManager.js and follow the on screen instructions.

Tech

On the surface Bamazon looks old-school but under the hood it's all modern. Bamazon runs on Node.js and uses MySQL to store data.

  • Node.js
  • MySQL
  • Packages

Challenges

This project's focus was on meshing Node and MySQL so at the beginning I assumed that's where I would face challenges, but my biggest challenge actually came when I decided to modularize the function that displays data on the screen as a table. I was originally running the displayProducts() function separately in both the customer and manger file but I really felt the need to make it its own module and import it into both files. I thought this would be easy, but of course when I made the change everything broke. The displayProducts() function is doing a number of things, it first queries the DB for products, then the return data has to be formatted in an array for table to render it properly, and then it runs an optional callback that is primarily used to display the next prompt for the user. The challenge arouse when I needed a query that gave me specific data rather than all the products in the table. My query was hard coded which obviously doesn't work if I need to change it, so after some contemplation I decided to pass in the query string as a parameter of displayProducts(). This works but I think in the future I would like to implement a solution that optionally takes in a query string and defaults to displaying all the products, as displaying all products is used most of the time.

Author

Craig Melville

bamazon's People

Contributors

acekreations avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.