Membuat platform untuk e-commerce
HEROKU = https://e-commerce-cms-gacor.herokuapp.com/ FIREBASE = https://e-commerce-a1e07.web.app/
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
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"
}
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"
}
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"
}
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"
}
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"
}
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"
}
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"
}
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"
}
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"
}
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"
}