Coder Social home page Coder Social logo

mhmmd-ysf / e-commerce-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from daring-fox-2019/e-commerce

0.0 1.0 0.0 31.56 MB

(DEPRECATED) Simple digital distribution platform for purchasing and playing video games. Built using vue.js.

Home Page: http://e-commerce.mhmmd-ysf.com

JavaScript 44.61% HTML 2.93% Vue 52.47%
vue html javascript vuetify

e-commerce-1's Introduction

ST-R-EAM

Simple digital distribution platform for purchasing and playing video games.

Dependencies

  • Node.js
  • MongoDB

Environtment Variables

JWT_SECRET

Project Setup

$ npm install
$ npm start

REST API Routes

Home Route

  • URL:
    • GET /
    • Response: 200 OK
      {
        "page": "Home",
        "project": "E-commerce"
      }

Authentication Routes

Registration

  • Description:
    • Creates a new user
  • URL:
    • POST /register
  • Body:
    • name: String (required)
    • email: String (required)
    • password: String (required)
  • Success response: 201 Created
  {
    "_id": "...",
    "name": "...",
    "email": "...",
    "password": "<hashed password>"
  }
  • Fail response(s):
    • 400 Bad request
    • 500 Internal Server Error

Login

  • Description:
    • Logs a user in
  • URL:
    • POST /login
  • Body:
    • email: String (required)
    • password: String (required)
  • Success response: 200 OK
  {
    "token": "...",
    "id": "...",
    "email": "...",
  }
  • Fail response(s):
    • 400 Bad request
    • 500 Internal Server Error

Product Routes

Create Product

  • Description:
    • Create a product
  • URL:
    • POST /products
  • Headers:
    • token: String (required)
  • Body:
    • name: String (required)
    • description: String (required)
    • price: Number (required)
    • featuredImg: String
    • stock: Number
    • tags: Array
  • Success response: 200 OK
  {
    "_id": "...",
    "name": "...",
    "description": "...",
    "featuredImg": "...",
    "stock": "...",
    "tags": "...",
    "price": "...",
  }
  • Fail response(s):
    • 401 Unauthorized
    • 500 Internal Server Error

Product List

  • Description:
    • Get list of all products
  • URL:
    • GET /products
  • Headers:
    • token: String (required)
  • Success response: 200 OK
  [
    {
      "_id": "...",
      "name": "...",
      "description": "...",
      "featuredImg": "...",
      "stock": "...",
      "tags": "...",
      "price": "...",
    }
  ]
  • Fail response(s):
    • 401 Unauthorized
    • 500 Internal Server Error

Find one product

  • Description:
    • Find one product
  • URL:
    • get /products/:productId
  • Headers:
    • token: String (required)
  • Success response: 200 OK
  {
    "_id": "...",
    "name": "...",
    "description": "...",
    "featuredImg": "...",
    "stock": "...",
    "tags": "...",
    "price": "...",
  }
  • Fail response(s):
    • 401 Unauthorized
    • 500 Internal Server Error

Update one product

  • Description:
    • Update one product
  • URL:
    • PUT /products/:productId
  • Headers:
    • token: String (required)
  • Body:
    • name: String (required)
    • description: String (required)
    • price: Number (required)
    • featuredImg: String
    • stock: Number
    • tags: Array
  • Success response: 200 OK
  {
    "_id": "...",
    "name": "...",
    "description": "...",
    "featuredImg": "...",
    "stock": "...",
    "tags": "...",
    "price": "...",
  }
  • Fail response(s):
    • 401 Unauthorized
    • 500 Internal Server Error

Delete one product

  • Description:
    • Delete one product
  • URL:
    • DELETE /products/:productId
  • Headers:
    • token: String (required)
  • Success response: 200 OK
  {
    "message": "Successfully deleted product.",
    "id": "<productId>",
  }
  • Fail response(s):
    • 401 Unauthorized
    • 500 Internal Server Error

Cart Routes

Create Cart

  • Description:
    • Adds one product into a cart model
  • URL:
    • POST /carts
  • Headers:
    • token: String (required)
  • Body:
    • product: String (required)
  • Success response: 200 OK
  {
    "_id": "...",
    "user": "<userId>",
    "product": "...",
  }
  • Fail response(s):
    • 401 Unauthorized
    • 500 Internal Server Error

Cart List

  • Description:
    • Get list of all carts
  • URL:
    • GET /carts
  • Headers:
    • token: String (required)
  • Success response: 200 OK
  {
    "_id": "...",
    "user": "<userId>",
    "product": "...",
  }
  • Fail response(s):
    • 401 Unauthorized
    • 500 Internal Server Error

User's Cart List

  • Description:
    • Get list of all user's carts
  • URL:
    • GET /carts/myCart
  • Headers:
    • token: String (required)
  • Success response: 200 OK
  {
    "_id": "...",
    "user": "<userId>",
    "product": "...",
  }
  • Fail response(s):
    • 401 Unauthorized
    • 500 Internal Server Error

Delete One Cart

  • Description:
    • Remove one product from user's cart
  • URL:
    • DELETE /carts/:cartId
  • Headers:
    • token: String (required)
  • Success response: 200 OK
  {
    "message": "Successfully deleted cart.",
    "id": "<cartId>",
  }
  • Fail response(s):
    • 401 Unauthorized
    • 500 Internal Server Error

Transaction Routes

Create Transaction

  • Description:
    • Adds one product into a cart model
  • URL:
    • POST /transactions
  • Headers:
    • token: String (required)
  • Body:
    • total: Number (required)
    • products: Array
  • Success response: 200 OK
  {
    "_id": "...",
    "user": "<userId>",
    "total": "...",
    "products": "...",
    "deliveryStatus": false,
    "createdAt": "...",
  }
  • Fail response(s):
    • 401 Unauthorized
    • 500 Internal Server Error

Transaction List

  • Description:
    • Get list of all transactions
  • URL:
    • GET /transactions
  • Headers:
    • token: String (required)
  • Success response: 200 OK
  [
    {
      "_id": "...",
      "user": "<userId>",
      "total": "...",
      "products": "...",
      "deliveryStatus": false,
      "createdAt": "...",
    }
  ]
  • Fail response(s):
    • 401 Unauthorized
    • 500 Internal Server Error

User's Transaction List

  • Description:
    • Get list of all user's transactions
  • URL:
    • GET /transactions/myTransaction
  • Headers:
    • token: String (required)
  • Success response: 200 OK
  [
    {
      "_id": "...",
      "user": "<userId>",
      "total": "...",
      "products": "...",
      "deliveryStatus": false,
      "createdAt": "...",
    }
  ]
  • Fail response(s):
    • 401 Unauthorized
    • 500 Internal Server Error

Claim The Game (Delivery Confirmation)

  • Description:
    • Change delivery status purchsed products
  • URL:
    • PUT /transactions/:transactionId
  • Headers:
    • token: String (required)
  • Body:
    • deliveryStatus: Boolean (required)
  • Success response: 200 OK
  {
    "_id": "...",
    "user": "<userId>",
    "total": "...",
    "products": "...",
    "deliveryStatus": false,
    "createdAt": "...",
  }
  • Fail response(s):
    • 401 Unauthorized
    • 500 Internal Server Error

Error statuses

  {
    "message": "<error message>"
  }
  • 400 Bad Request
The request cannot be fulfilled due to bad syntax. General error when fulfilling the request would cause an invalid state. Domain validation errors, missing data, etc. are some examples.
- `401` Unauthorized
The request requires user authentication. If the request already included Authorization credentials, then this response indicates that authorization has been refused for those credentials. This happens when authentication is possible but has failed or not yet been provided.
- `404` Not Found ๐Ÿ˜ฅ
The server has not found anything matching the Request-URI or the requested resource is not found.
- `500` Internal Server Error
The server encountered an unexpected condition which prevented it from fulfilling the request.

e-commerce-1's People

Contributors

mhmmd-ysf avatar dmtrxw avatar

Watchers

James Cloos 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.