Client
===================
1. npm install
2. npm run serve
Server
===================
1. npm install
2. npm run test
Testing
===================
1. npm run test
2. update role newUser jadi admin di database
3. npm run test
Website : http://posterpedia.cado.store/ Postman : https://documenter.getpostman.com/view/6836981/SVmvSe8r
Route : /login
Method : POST
Headers : -
Body :
{
"email" : "[email protected]",
"password" : "johnDoe123"
}
Response :
Success :
{
"token": <TOKEN>,
"user": Object
}
Error :
{
"status" : 400,
"message" : []
}
Route : /register
Method : POST
Headers : -
Body :
{
"username" : "johnDoe",
"email" : "[email protected]",
"password" : "johnDoe123"
}
Response :
Success :
{
"createdUser"
}
Error :
{
"status": 401,
"message": "User already registered"
}
Route : /products
Method : GET
Body : -
Response :
Success :
{
[ productObj ]
}
Route : /products/detail/:id
[ id -> productId ]
Method : GET
Body : -
Response :
Success :
{
{ productObj }
}
Error:
{
"status" : 404,
"message": "Product not found"
}
Must LOGIN to use feature below
Admin Privilege [MUST LOGIN AS AN ADMIN]
Route : /products
Method : POST
Headers : TOKEN
Body :
{
"name" : STRING,
"price" : NUMBER,
"stock" : NUMBER,
"category" : STRING,
"description : STRING,
"file" : <IMAGE FILE TYPE>
}
Response :
Success :
{
"createdProduct"
}
Error :
{
status : 400,
message : []
}
Route : /products/:id
Method : PUT
Headers : TOKEN
Body :
{
"name" : STRING,
"price" : NUMBER,
"stock" : NUMBER,
"category" : STRING,
"description" : STRING
"file" : <IMAGE FILE TYPE>
}
Response :
Success :
{
"updatedPreviousProduct"
}
Error :
{
status : 400,
message : []
}
Route : /products/:id
Method : PUT
Headers : TOKEN
Body :
{
"name" : STRING,
"price" : NUMBER,
"stock" : NUMBER,
"category" : STRING,
"description" : STRING
"file" : <IMAGE FILE TYPE>
}
Response :
Success :
{
"updatedPreviousProduct"
}
Error :
{
status : 400,
message : []
}
Customer Privilege [MUST LOGIN AS AN Customer]
Route : /products/cart
Method : GET
Headers : TOKEN
Body : -
Response :
Success :
{
[ cartObject ]
}
Route : /products/cart
Method : GET
Headers : TOKEN
Body :
{
"productId"
"quantity"
}
Response :
Success :
{
[ cartObject ]
}
Route : /products/cart/:id
[:id -> cartId]
Method : PATCH
Headers : TOKEN
Body :
{
"quantity"
}
Response :
Success :
{
previousUpdatedCart
}
Route : /products/cart/:id
[:id -> cartId]
Method : DELETE
Headers : TOKEN
Body : -
Response :
Success :
{
deletedCart
}