Giter Club home page Giter Club logo

moving_sale_e-shop's Introduction

Moving_Sale_E-Shop

Cooperated with teammate to develop and deployed web application on AWS EC2 by using Node.js Express, Vue.js, MongoDB Atlas, AWS RDS, Cloudinary and GraphQL API.

To see the app in action

The Database Schema

MySQL

CREATE TABLE user(
  user_id VARCHAR(40) NOT NULL CHECK (user_id <> ''),
  userName VARCHAR(40) NOT NULL CHECK (userName <> ''),
  account VARCHAR(40) NOT NULL CHECK (account <> ''),
  email VARCHAR(50) NOT NULL CHECK (email <> ''),
  pass VARCHAR(50) NOT NULL CHECK (pass <> ''),
  PRIMARY KEY (user_id)
);

CREATE TABLE product(
  product_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  productName VARCHAR(40) NOT NULL CHECK (productName <> ''),
  seller VARCHAR(40) NOT NULL DEFAULT 'Alison',
  price INT UNSIGNED NOT NULL CHECK (price >= 0),
  category VARCHAR(40) NOT NULL,
  boughtDate VARCHAR(40) NOT NULL,
  product_photo VARCHAR(150) NOT NULL CHECK (product_photo <> ''),
  look_like VARCHAR(150) NOT NULL CHECK (look_like <> ''),
  numberOfProduct INT NOT NULL CHECK (numberOfProduct >= 0),
  descript VARCHAR(200) NOT NULL,
  PRIMARY KEY (product_id)
);

CREATE TABLE history(
  history_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  price INT UNSIGNED NOT NULL,
  buyer VARCHAR(40) NOT NULL CHECK (buyer <> ''),
  seller VARCHAR(40) NOT NULL CHECK (seller <> ''),
  buy_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  product_name VARCHAR(40) NOT NULL CHECK (product_name <> ''),
  num INT UNSIGNED NOT NULL,
  PRIMARY KEY (history_id)
);

GraphQL

type Product {
  productId:    ID!
  productName:  String!
  price:        Int!
  seller:       User!
  category:     String!
  boughtDate:   String!
  product_photo:String!
  look_like:    String!
  numberOfProduct: Int!
  descript:     String!
}

type User {
  userId:       ID!
  userName:     String
  account:      String!
  pass:         String!
  email:        String!
  products:     [Product]
  buyProducts:  [History]
}

type History {
  buyer:        String
  buy_at:       String
  num:          Int
  product_name: String
  price:        Int
}

Architecuture

Flow Chart

Features

  • Used node.js express as backend, Vue.js as frontend and integrated with MongoDB Atlas and AWS RDS.
  • Used GraphQL to fetch and update data in database.
  • Used local strategy of Passport.js for authentication and authorization.
  • Implemented shopping cart by using LocalStorage and MySQL.

Prerequisites

1. MySQL server start

Please start your MySQL server. And then create database and tables which is mentioned above.

CREATE DATABASE project

2. Edit database.js

Change the host ip.

3. Key of Cloudinary and MongoDB Atlas

Create an .env file copy and paste the following lines inside

CLOUDINARY_CLOUD_NAME=xxxx
CLOUDINARY_KEY=xxxx
CLOUDINARY_SECRET=xxxx
DB_URL=xxxxx

Run the program

Please run:

cd Moving_Sale_E-Shop
node index.js

Major files

index.js: All GET and POST
database.js: Connect with MySQL server
login.ejs: Page to login
register.ejs: Page to register as a member
profile.ejs: Users' personal information
home.ejs: Home Page
about.ejs: Page of our self-introduction
product.ejs: Page of listing all selling goods
productDetail.ejs: Detail of a specific product
add.ejs: Page to upload a new product
controllers/users.js: Logic part of login, logout and register
routes/users.js: Route part of login, logout and register
resolvers.js: Logic part of GraphQL

moving_sale_e-shop's People

Contributors

ja841014 avatar wenhsinlee avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.