Giter VIP home page Giter VIP logo

e-commerce-cms_'s Introduction

e-commerce-cms

Demo User => email: [email protected] | password:123

 

Content Management System for E-Commerce (Admin User)

  • RESTful endpoint for product's CRUD operation
  • JSON formatted response

 

RESTful endpoints

POST /register

Create new user

Request Header

not needed

Request Body

{
  "name": <your name>,
  "email": <your email>,
  "password": <your password>
}

Success Response:

Response (201 - Created)

{
  "id": <id>,
  "name": <your name>,
  "email": <your email >,
  "password": <your encrypted password>,
  "updatedAt": <date>,
  "createdAt": <date>
}

Error Response:

Response (400 - Bad Request)

[
  "message": <detail message>
]

Response (409 - conflict)

{
  "message": "Email Already registered!"
}

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

POST /login

Process Login

Request Header

not needed

Request Body

{
  "email": <your email>,
  "password": <your password>
}

Success Response:

Response (200 - Ok)

{
  "access_token": <your access token>
}

Error Response:

Response (400 - Bad Request)

[
  "message": <detail message>
]

Response (404 - Not Found)

{
  "message": "user not registered!"
}

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

POST /products

Create new product

Request Header

{
  "access_token": <your access token>
}

Request Body

{
  "name": <product name>,
  "description": <product description>,
  "category": <product category>,
  "price": <product price>,
  "stock": <product stock>,
  "image_url": <product image>,
},

Success Response:

Response (201 - Created)

{
  "id": <product id>,
  "name": <product name>,
  "description": <product description>,
  "category": <product category>,
  "price": <product price>,
  "stock": <product stock>,
  "image_url": <product image>,
  "UserId": <UserId>
},

Error Response:

Response (400 - Bad Request)

[
  "message": <message detail>
]

Response (401 - Unauthorized)

{
  "message": "Not authenticated!"
}

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

GET /products

Get User's products

Request Header

{
  "access_token": <your access token>
}

Request Body

not needed

Success Response:

Response (200 - Ok)

[
  {
    "id": <product id>,
    "name": <product name>,
    "description": <product description>,
    "category": <product category>,
    "price": <product price>,
    "stock": <product stock>,
    "image_url": <product image>,
    "UserId": <UserId>
  },
  {
    "id": <product id>,
    "name": <product name>,
    "description": <product description>,
    "category": <product category>,
    "price": <product price>,
    "stock": <product stock>,
    "image_url": <product image>,
    "UserId": <UserId>
  },
]

Error Response:

Response (401 - Unauthorized)

{
  "message": "Not authenticated!"
}

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

GET /products/:id

Get product by product's id

Request Header

{
  "access_token": <your access token>
}

Request Body

not needed

Success Response:

Response (200 - Ok)

{
  "id": <product id>,
  "name": <product name>,
  "description": <product description>,
  "category": <product category>,
  "price": <product price>,
  "stock": <product stock>,
  "image_url": <product image>,
  "UserId": <UserId>
},

Error Response:

Response (401 - Unauthorized)

{
  "message": "Not authenticated!"
}

Response (403 - Forbidden)

{
  "message": "Forbidden access!"
}

Response (404 - Not Found)

{
  "message": "product not found! "
}

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

PUT /products/:id

Update product

Request Header

{
  "access_token": <your access token>
}

Request Body

{
  "name": <product name>,
  "description": <product description>,
  "category": <product category>,
  "price": <product price>,
  "stock": <product stock>,
  "image_url": <product image>,
},

Success Response:

Response (200 - OK)

{
  "id": <product id>,
  "name": <product name>,
  "description": <product description>,
  "category": <product category>,
  "price": <product price>,
  "stock": <product stock>,
  "image_url": <product image>,
  "UserId": <UserId>
},

Error Response:

Response (401 - Unauthorized)

{
  "message": "Not authenticated!"
}

Response (403 - Forbidden)

{
  "message": "Forbidden access!"
}

Response (404 - Not Found)

{
  "message": "product not found! "
}

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

DELETE /products/:id

Update product

Request Header

{
  "access_token": <your access token>
}

Request Body

not needed

Success Response:

Response (200 - Ok)

{
  "id": <product id>,
  "name": <product name>,
  "description": <product description>,
  "category": <product category>,
  "price": <product price>,
  "stock": <product stock>,
  "image_url": <product image>,
  "UserId": <UserId>
}

Error Response:

Response (401 - Unauthorized)

{
  "message": "Not authenticated!"
}

Response (403 - Forbidden)

{
  "message": "Forbidden access!"
}

Response (404 - Not Found)

{
  "message": "product not found! "
}

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

e-commerce-cms_'s People

Contributors

2maleek avatar stefkwan avatar

Watchers

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