Skip to content

rachimawan/e-commerce-cms

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

e-commerce-cms

Membuat Content Management System untuk e-commerce E-Commerce-CMS with name Tokoku. This app has:

 

Endpoints

- POST /login
- GET /products
- POST /products
- GET /products/:id
- PUT /products/:id
- DELETE /products/:id

RESTful endpoints

POST /login

Login to Tokoku

Request Header

not needed

Request Body

{
    "email": "<email to get insert into>",
    "password": "<password to get insert into>"
}

Response (200)

{
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwidXNlcm5hbWUiOiJmYXVkemFuIiwiaWF0IjoxNTk4OTU1OTk2fQ.-bZ3Gi4AXPQMtrHfbxJ605On57u4gRXfU0ok88aIW94"
}

Response (400 - Bad Request)

{
    "message": "Invalid email or password"
}

Response (500 - Internal Server Error)

{
    "message": "Internal Server Error"
}

GET /products

Show all Tokoku products

Request Header

{
  "access_token": "<your access token>"
}

Request Body

not needed

Response (200)

{
   "id": "<id_of_the_product>",
    "name": "<product_name>",
    "image_url": "<product_image_url>",
    "price": "<product_price>",
    "stock": "<product_stock>",
    "createdAt": "2020-09-09T14:55:06.648Z",
    "updatedAt": "2020-09-09T15:30:58.690Z", 
}

Response (401 - Not Authenticated)

{
  "message": "Doesnt recognize user.."
}

Response (500 - Internal server error)

{
  "message": "Internal Server Error"
}

POST /products

Create new products

Request Header

{
  "access_token": "<your access token>"
}

Request Body

{
  "name": "<name to get insert into>",
  "image_url": "<image_url to get insert into>",
  "price": "<price to get insert into>",
  "stock": "<stock to get insert into>"
}

Response (201 - Created)

{
  "id": "<given id by system>",
  "name": "<posted name>",
  "image_url": "<posted image_url>",
  "price": "<posted price>",
  "stock": "<posted stock>",
  "createdAt": "2020-03-20T07:15:12.149Z",
  "updatedAt": "2020-03-20T07:15:12.149Z",
}

Response (401 - Not Authenticated)

{
  "message": "Doesnt recognize user.."
}

Response (400 - Bad Request)

{
  "message": "Please fill the field!, Do not input value under 1!"
}

GET /products/:id

Find detail product by ID

Request Header

{
  "access_token": "<your access token>"
}

Request Body

not needed

Response (200)

{
   "id": 1,
    "name": "<product_name>",
    "image_url": "<product_image_url>",
    "price": "<product_price>",
    "stock": "<product_stock>",
    "createdAt": "2020-09-09T14:55:06.648Z",
    "updatedAt": "2020-09-09T15:30:58.690Z", 
}

Response (401 - Not Authenticated)

{
  "message": "Doesnt recognize user.."
}

Response (404 - Not Found)

{
  "message": "Not Found"
}

PUT /products/:id

Update product by ID

Request Header

{
  "access_token": "<your access token>"
}

Request Body

{
  "name": "<name to get insert into>",
  "image_url": "<image_url to get insert into>",
  "price": "<price to get insert into>",
  "stock": "<stock to get insert into>"
}

Response (200)

{
  "id": "<selected id>",
  "name": "<updated name>",
  "image_url": "<updated image_url>",
  "price": "<updated price>",
  "stock": "<updated stock>",
  "createdAt": "2020-03-20T07:15:12.149Z",
  "updatedAt": "2020-03-20T07:15:12.149Z",
}

Response (400 - Bad request)

{
  "message": "Please fill the field!, Do not input value under 1!"
}

Response (404 - Not Found)

{
  "message": "Not Found"
}

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

DELETE /products/:id

Delete product data by ID

Request Header

{
  "access_token": "<your access token>"
}

Request Body

not needed

Response (200)

{
   "id": 1,
    "name": "<product_name>",
    "image_url": "<product_image_url>",
    "price": "<product_price>",
    "stock": "<product_stock>",
    "createdAt": "2020-09-09T14:55:06.648Z",
    "updatedAt": "2020-09-09T15:30:58.690Z", 
}

Response (404 - Not Found)

{
  "message": "Not Found"
}

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

About

Membuat Content Management System untuk e-commerce

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 77.1%
  • Vue 15.7%
  • CSS 5.3%
  • HTML 1.9%