Giter VIP home page Giter VIP logo

shoppingcart-react-nodejs-electron's Introduction

About

Name: MyCart

Description: Shopping cart implementation using React, NodeJs, MySQL, ExpressJs, axios, cors, sequelize, Babel, Webpack, and Electron. (MERN Stack)

Prerequisites

NodeJS and MySQL Community Server should be installed.

Installation

git clone https://github.com/nishantsahoo/ShoppingCart-React-NodeJs.git

Execution steps

1. Web Application

Step 1: Install all node modules using npm
cd API_Node_Folder
npm install
cd ..
cd Front_End_React_Folder
npm install
Step 2: Create the table "shoppingcart" using MySQL

Open the MySQL Command Line Client and execute the following code

create database shoppingcart
Step 3: Execute ./API_Node_Folder/seedProductsTable.js file to add products into the products table
Step 4: Execute the webpack file

Note: Use "watch" with webpack to develop and deploy continuously

cd Front_End_React_Folder
.\node_modules\.bin\webpack --watch
Step 5: Start the API(Express) server

Note: Express server hosted at localhost:9000

cd API_Node_Folder
npm start
Step 6: Start the Client (React) server

Note: React server hosted at localhost:8000

cd Front_End_React_Folder
npm run webapp
Step 7: Open the browser and navigate to http://localhost:8000/

2. Desktop Application

Step 1: Install all node modules using npm
cd API_Node_Folder
npm install
cd ..
cd Front_End_React_Folder
npm install
Step 2: Create the table "shoppingcart" using MySQL

Open the MySQL Command Line Client and execute the following code

create database shoppingcart
Step 3: Execute ./API_Node_Folder/seedProductsTable.js file to add products into the products table
Step 4: Execute the webpack file

Note: Use "watch" with webpack to develop and deploy continuously

cd Front_End_React_Folder
.\node_modules\.bin\webpack --watch
Step 5: Start the API(Express) server

Note: Express server hosted at localhost:9000

cd API_Node_Folder
npm start
Step 6: Launch the desktop application
cd Front_End_React_Folder
npm start

or

npm run desktopapp

Database settings

Database name: shoppingcart

Username: root

Password: root

1. MySQL connection

const db = new Sequelize('shoppingcart', 'root', 'root', {
    host: 'localhost',
    dialect: 'mysql',
    pool: {
        max: 10,
        min: 0,
        idle: 1000
    }
});

2. Tables

  1. Products

    id: {
        type: INTEGER,
        primaryKey: true,
    },
    name: STRING,
    price: INTEGER,
    quantity: INTEGER
    
  2. Cart

    id: {
        type: INTEGER,
        primaryKey: true,
    },
    name: STRING,
    price: INTEGER,
    quantity: INTEGER,
    amount: INTEGER
    

APIs

1. Products:

/myapi/products/

  1. /getproducts: To get all products from the products table
  2. /addtoproducts: To add a product to the products table
2. Cart

/myapi/cart/

  1. /getcart: To get all cart items from the cart table
  2. /addtocart: To add a product to the cart
  3. /checkout: To checkout from the cart (Removes all products from the cart)
  4. /decrementCart: To decrease the quantity of a particular cart item
  5. /incrementCart: To increase the quantity of a particular cart item
  6. /delfromcart: To delete a particular cart item from the cart
  7. /countproducts: To count the number of products in a cart
  8. /totalamount: To calculate the total amount to be paid

shoppingcart-react-nodejs-electron's People

Contributors

nishantsahoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

shoppingcart-react-nodejs-electron's Issues

Executing Seeds Product Table

When executed I get the error Unhandled rejection SequelizeDatabaseError: Table 'shoppingcart.products' doesn't exist after table is created.

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.