Skip to content

amz2694/shop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shop

Table of Contents

General Info

Shop is a Full stack Online shop.

Technologies

  • HTML/CSS3
  • NodeJs
  • Express
  • Vue 3
  • Vue router
  • Vuex
  • MySQL

How To Use

Installation

You can install Shop locally using npm.

Front-End project setup

Install dependencies using:

cd front
npm install

Compile and hot-reload for development using:

npm run serve

Compile and minifile for production by running:

npm run build

Back-End project setup

Install dependencies using:

cd back
npm install

Compiles for development using:

npm run dev

or start the server by using the following command:

npm start

database setup

Run back/sql/createDB.sql file to create database called shop

API Reference

You can get all carts using:

GET   /getcart

Login is required to request this API. Make sure to put Bearer accessToken in header.Authorization.

200 status code return array of objects


get all comments of a product using:

GET  /comment
Parameter Type
ID Number

200 status code return array of objects


get discounted product using:

GET  /discount

200 status code return array of objects


get products for different genders using:

GET  /gender
Parameter Type
gender String

200 status code return array of objects


get latest products using:

GET  /newest

200 status code return array of objects


search products using:

GET  /search
Parameter Type
search String

200 status code return array of objects


get the product using:

GET  /product
Parameter Type
ID Number

200 status code return

{
  commodityID  : Number,
  commodityName : String,
  gender : String,
  startingOdor : String,
  middleOdor : String,
  finalOdor : String,
  volume : Number,
  price : Number,
  discount : Number,
  pictureURL : String
}

post a cart :

POST  /cart

The request should be a JSON in the form of

{
  payment : String,
  cart    : [
      {ID : Number, quantity : Number},
      ...
  ],
}

Login is required to request this API. Make sure to put Bearer accessToken in header.Authorization.

201 status code return { "success": 'created!' }


get the user:

GET  /user

Login is required to request this API. Make sure to put Bearer accessToken in header.Authorization.

200 status code return

{
  customerID : Number,
  customer : String,
  address : String,
  email : String,
}

make changes in user information :

PUT  /user

The request should be a JSON and include one or more

{
  user  : String,
  pwd   : String,
  add   : String
}

200 status code return { "message": 'user changed' }


Delete user :

DELETE  /user

Login is required to request this API. Make sure to put Bearer accessToken in header.Authorization. 200 status code return { "message": 'user deleted' }


Sign up :

POST  /register

The request should be a JSON in the form of

{
  user  : String,
  email : String,
  pwd   : String,
  add   : String
}

201 status code return { "success": 'new user ${user} created!' }

other status code :

Status Code Description
201 CREATED
400 BAD REQUEST
409 Conflict
500 INTERNAL SERVER ERROR

Login to an existing account :

GET  /login

The request should be a JSON in the form of

{
  user  : string,
  pwd   : string
}

200 status code return {accessToken : string} which expires after 30 seconds. The refreshToken is set as a cookie which expires after 1 day.

other status code :

Status Code Description
200 OK
400 BAD REQUEST
401 UNAUTHORIZED
500 INTERNAL SERVER ERROR

To get new accessToken :

GET   /refresh

200 status code return {accessToken : string}

other status code :

Status Code Description
200 OK
401 UNAUTHORIZED
403 FORBIDDEN
500 INTERNAL SERVER ERROR

License

licensed under the MIT License.

Back To The Top