Skip to content

bobkombat/e-commerce

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

e-commerce

Membuat platform untuk e-commerce

HEROKU = https://e-commerce-cms-gacor.herokuapp.com/ FIREBASE = https://e-commerce-a1e07.web.app/

RESTful endpoints

List of available endpoint:

  • POST /products
  • GET /products
  • PUT /products/:id
  • DELETE /products/:id
  • POST /login
  • POST /register
  • POST /cart
  • GET /cart
  • PUT /cart/:id
  • DELETE /cart/:id

POST /products

Request headers

{
  "access_token": "<access_token>"
}

Request Body

  {
    "name": "string",
    "image_url": "string",
    "price": "integer",
    "stock": "integer"
  }

Response (201 - Created)

  {
    "id": "integer",
    "name": "string",
    "image_url": "string",
    "price": "integer",
    "stock": "integer",
    "createdAt": "date",
    "updatedAt": "date"
  }

Response (400 - Bad Request)

[
  {
    "message": "name is empty"
  },
  {
    "message": "image_url is empty"
  }
]

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

GET /products

Request headers

{
  "access_token": "<access_token>"
}

Response (200 - OK)

[
  {
    "id": 1,
    "name": "sepatu",
    "image_url": "unplash.com",
    "price": 6,
    "stock": 1
  },
  {
    "id": 2,
    "name": "kaos",
    "image_url": "pexels.com",
    "price": 5,
    "stock": 2
  },
  {
    "id": 3,
    "name": "kaos kaki",
    "image_url": "google.com",
    "price": 10,
    "stock": 1
  }
]

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

PUT /products/:id

Request headers

{
  "access_token": "<access_token>"
}

Request Body

  {
    "name": "string",
    "image_url": "string",
    "price": "integer",
    "stock": "integer"
  }

Response (200 - OK)

  {
    "id": "integer",
    "name": "string",
    "image_url": "integer",
    "price": "integer",
    "stock": 1,
    "createdAt": "date",
    "updatedAt": "date"
  }

Response (400 - Bad Request)

[
  {
    "message": "name is empty"
  },
  {
    "message": "image_url is empty"
  }
]

Response (404 - Not Found)

{
  "message": "error Not Found"
}

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

DELETE /products/:id

Request headers

{
  "access_token": "<access_token>"
}

Response (200 - OK)

  {
    "id": "integer",
    "name": "string",
    "image_url": "string",
    "price": "integer",
    "stock": "integer",
    "createdAt": "date",
    "updatedAt": "date"
  }

Response (404 - Not Found)

{
  "message": "error Not Found"
}

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

POST /login

Request Body

  {
    "email": "string",
    "password": "string"
  }

Response (200 - OK)

  {
    "access_token": "<access_token>"
  }

Response (400 - Bad Request)

[
  {
    "message": "You don't put any password"
  },
  {
    "message": "You don't put any email"
  }
]

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

POST /cart

Request headers

{
  "access_token": "<access_token>"
}

Request Body

  {
    "quantity": "integer",
    "status": "boolean",
    "UserId": "integer",
    "ProductId": "integer"
  }

Response (201 - Created)

  {
    "id": "integer",
    "quantity": "integer",
    "status": "boolean",
    "UserId": "integer",
    "ProductId": "integer",
    "createdAt": "date",
    "updatedAt": "date"
  }

Response (400 - Bad Request)

[
  {
    "message": "quantity is empty"
  },
  {
    "message": "status is empty"
  }
]

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

GET /cart

Request headers

{
  "access_token": "<access_token>"
}

Response (200 - OK)

[
  {
    "id": 1,
    "quantity": 1,
    "status": true,
    "UserId": 1,
    "ProductId": 2,
    "Product": "Product"
  },
  {
    "id": 2,
    "quantity": 5,
    "status": true,
    "UserId": 1,
    "ProductId": 2,
    "Product": "Product"
  },
  {
    "id": 3,
    "quantity": 1,
    "status": true,
    "UserId": 1,
    "ProductId": 2,
    "Product": "Product"
  }
]

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

PUT /products/:id

Request headers

{
  "access_token": "<access_token>"
}

Request Body

  {
    "quantity": "integer",
    "status": "boolean",
    "UserId": "integer",
    "ProductId": "integer"
  }

Response (200 - OK)

  {
    "id": "integer",
    "quantity": "integer",
    "status": "boolean",
    "UserId": "integer",
    "ProductId": "integer",
    "createdAt": "date",
    "updatedAt": "date"
  }

Response (400 - Bad Request)

[
  {
    "message": "quantity is empty"
  },
  {
    "message": "status is empty"
  }
]

Response (404 - Not Found)

{
  "message": "error Not Found"
}

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

DELETE /products/:id

Request headers

{
  "access_token": "<access_token>"
}

Response (200 - OK)

  {
    "id": "integer",
    "quantity": "integer",
    "status": "boolean",
    "UserId": "integer",
    "ProductId": "integer",
    "createdAt": "date",
    "updatedAt": "date"
  }

Response (404 - Not Found)

{
  "message": "error Not Found"
}

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

POST /register

Request Body

  {
    "email": "string",
    "password": "string"
  }

Response (200 - OK)

  {
    "id": "integer",
    "email": "string",
    "role": "user"
  }

Response (400 - Bad Request)

[
  {
    "message": "You don't put any password"
  },
  {
    "message": "You don't put any email"
  }
]

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

About

Membuat platform untuk e-commerce

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vue 72.7%
  • JavaScript 24.3%
  • HTML 3.0%