Name: MyCart
Description: Shopping cart implementation using React, NodeJs, MySQL, ExpressJs, axios, cors, sequelize, Babel, Webpack, and Electron. (MERN Stack)
NodeJS and MySQL Community Server should be installed.
git clone https://github.com/nishantsahoo/ShoppingCart-React-NodeJs.git
cd API_Node_Folder
npm install
cd ..
cd Front_End_React_Folder
npm install
Open the MySQL Command Line Client and execute the following code
create database shoppingcart
Note: Use "watch" with webpack to develop and deploy continuously
cd Front_End_React_Folder
.\node_modules\.bin\webpack --watch
Note: Express server hosted at localhost:9000
cd API_Node_Folder
npm start
Note: React server hosted at localhost:8000
cd Front_End_React_Folder
npm run webapp
cd API_Node_Folder
npm install
cd ..
cd Front_End_React_Folder
npm install
Open the MySQL Command Line Client and execute the following code
create database shoppingcart
Note: Use "watch" with webpack to develop and deploy continuously
cd Front_End_React_Folder
.\node_modules\.bin\webpack --watch
Note: Express server hosted at localhost:9000
cd API_Node_Folder
npm start
cd Front_End_React_Folder
npm start
or
npm run desktopapp
Database name: shoppingcart
Username: root
Password: root
const db = new Sequelize('shoppingcart', 'root', 'root', {
host: 'localhost',
dialect: 'mysql',
pool: {
max: 10,
min: 0,
idle: 1000
}
});
-
Products
id: { type: INTEGER, primaryKey: true, }, name: STRING, price: INTEGER, quantity: INTEGER
-
Cart
id: { type: INTEGER, primaryKey: true, }, name: STRING, price: INTEGER, quantity: INTEGER, amount: INTEGER
/myapi/products/
/getproducts
: To get all products from the products table/addtoproducts
: To add a product to the products table
/myapi/cart/
/getcart
: To get all cart items from the cart table/addtocart
: To add a product to the cart/checkout
: To checkout from the cart (Removes all products from the cart)/decrementCart
: To decrease the quantity of a particular cart item/incrementCart
: To increase the quantity of a particular cart item/delfromcart
: To delete a particular cart item from the cart/countproducts
: To count the number of products in a cart/totalamount
: To calculate the total amount to be paid