- clone the repository
- run
npm install
- copy
cp .env.example .env
- set your config in
.env
- run
npm start
- create a new project
- run
gcloud app create
- copy
cp .env.example .env
- set your config in
.env
- npm install
- run
gcloud app deploy
- visit [your app](https://[your app].appspot.com)
- host :
https://goloak.uc.r.appspot.com/
- Method : POST
- Endpoint :
{host}/auth/signup
Body :
{
"fullname": "Mamang Loak",
"password": "mypassword",
"email" : "Mamank@bangkit.academy",
"phone_number" : "08123456789",
"address" : "address"
}
Response :
{
"message": "success"
}
- Method : POST
- Endpoint :
{host}/auth/login
Body :
{
"password": "mypassword",
"email" : "Mamank@bangkit.academy"
}
Response :
{
"message": "success",
"id": "6295a72534a102d8dbc5104e",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYyOTVhNzI1MzRhMTAyZDhkYmM1MTA0ZSIsImVtYWlsIjoibWFtYW5rQGJhbmdraXQuYWNhZGVteSIsImlhdCI6MTY1Mzk3NDk4MywiZXhwIjoxNjU0MDYxMzgzfQ.-l1IbxCGYxeX2Ta45UIaldA-K2cYGsOHF0i8Lh2iOFY"
}
- Method : POST
- Endpoint :
{host}/auth/forgot
Body :
{
"email" : "mamank@bangkit.academy"
}
Response :
{
"message": "success"
}
- Method : POST
- Endpoint :
{host}/reset-password/:token
Body :
{
"password" : "myspassword121212"
}
Response :
{
"message": "success"
}
- Method : GET
- Endpoint :
{host}/api/selling/:userId
Response :
{
"message": "success",
"listSelling": [
{
"_id": "629961f1cfa2610d24c81eb3",
"total_trash": 10,
"total_point": 1111,
"status": "Menunggu penjemputan",
"nameTrash": "Plastik PE",
"photoUrl": "http://url/goloak_1654219249_IOjDnx.jpg",
"fileSize": "17.72 KB",
"createAt": "2022-06-03T01:20:24.919Z",
"pengguna": "62995cde1069186263559034"
},
{
"_id": "62996171029bcd4d0802e898",
"total_trash": 10,
"total_point": 1111,
"status": "Menunggu penjemputan",
"nameTrash": "Plastik PE",
"photoUrl": "http://url/goloak_1654219121_ezunmU.jpg",
"fileSize": "17.72 KB",
"createAt": "2022-06-03T01:18:02.808Z",
"pengguna": "62995cde1069186263559034"
}
]
}
- Method : POST
- Endpoint :
{host}/api/selling/:userId
Header :
token : key token
Body :
{
"total_trash" : 10,
"total_point" : 100,
"nameTrash" : "Plastic PE"
}
Files:
{ files: { file: filesInputElement } }
=> Max file size: 20 MB
Response :
{
"message": "success"
}
- Method : GET
- Endpoint :
{host}/api/point/:userId
Response :
{
"message": "success",
"historyPoint": [
{
"_id": "6295affa113cae41ea569a1c",
"point_min": 100,
"status": "pembayaran memakai pulsa",
"start_date": "2022-05-31T06:03:05.922Z",
"pengguna": "6295a72534a102d8dbc5104e"
},
{
"_id": "6295b06c113cae41ea569a24",
"point_min": 1000,
"status": "pembayaran memakai pulsa",
"start_date": "2022-05-31T06:03:05.922Z",
"pengguna": "6295a72534a102d8dbc5104e"
},
{
"_id": "6295ae85029e7bff8ddebd87",
"point_min": 100,
"status": "pembayaran memakai pulsa",
"start_date": "2022-05-31T05:57:37.575Z",
"pengguna": "6295a72534a102d8dbc5104e"
}
]
}
- Method : POST
- Endpoint :
{host}/api/point/:userId
Header :
token : key token
Body :
{
"point_min" : 100,
"status" : "pembayaran memakai pulsa"
}
Response :
{
"message": "success"
}
- Method : GET
- Endpoint :
{host}/api/profile/:userId
Response :
{
"message": "success",
"fullname": "Mamang Loak",
"email": "mamank@bangkit.academy",
"phone_number": "08123456789",
"address": "address",
"point": 0
}
- Method : PUT/PATCH
- Endpoint :
{host}/api/point/:userId
Body :
{
"fullname": "mamang loak",
"email": "mamank@bangkit.academy",
"phone_number": "123",
"address": "jalan-jalan",
"point": 0
}
Response :
{
"message": "success",
"newUser": {
"fullname": "mamang loak",
"email": "mamank@bangkit.academy",
"phone_number": "123",
"address": "jalan-jalan",
"point": 0
}
}
- Method : DELETE
- Endpoint :
{host}/api/point/:userId
Response :
{
"message": "success"
}
- Method : GET
- Endpoint :
{host}/api/home/:userId
Header :
token : key token
Response :
{
"message": "success",
"fullname": "Mamang Loak",
"email": "mamank@bangkit.academy",
"phone_number": "08123456789",
"address": "address",
"point": 0,
"listTrash": [
{
"_id": "6295a1c834a102d8dbc5104c",
"name": "botol",
"type": "kaca",
"description": "botol kaca",
"price": 1200,
"image": "http://url/goloak_1653973448_ymFBQb.jpg",
"fileSize": "77.14 KB"
},
{
"_id": "6295b13597089dd759c2c142",
"name": "botol",
"type": "kaca",
"description": "botol kaca",
"price": 1200,
"image": "http://url/goloak_1653977397_BkWtPS.jpg",
"fileSize": "77.14 KB"
},
{
"_id": "6295c49b9fe329588c22dae6",
"name": "botol",
"type": "kaca",
"description": "botol kaca",
"price": 1200,
"image": "http://url/goloak_1653982363_OzwWmr.jpg",
"fileSize": "77.14 KB"
}
]
}
- Method : POST
- Endpoint :
{host}/api/trash
Body :
{
"total_trash" : 10,
"total_point" : 100,
"nameTrash" : "Plastic PE"
}
Files:
{ files: { file: filesInputElement } }
=> Max file size: 20 MB
Response :
{
"message": "success",
"results": {
"name": "botol",
"type": "kaca",
"description": "botol kaca",
"price": 1200,
"image": "http://url/goloak_1654430827_VogLgw.jpg",
"fileSize": "7.79 MB",
"_id": "629c9c6bb5f03a97292fb252"
}
}
- Method : GET
- Endpoint :
{host}/api/trash
Body :
{
"message": "success",
"listTrash": [
{
"_id": "629c9c6bb5f03a97292fb252",
"name": "botol",
"type": "kaca",
"description": "botol kaca",
"price": 1200,
"image": "http://url/goloak_1654430827_VogLgw.jpg",
"fileSize": "7.79 MB"
}
]
}
- Method : GET
- Endpoint :
{host}/admin/user/
Header :
type : API Key
key : token
value : your token
Response :
{
"message": "success",
"listUser": [
{
"_id": "629e3f2adef49892ddbc8139",
"fullname": "mamank loak",
"email": "mamank@bangkit.academy",
"password": "encrypted",
"phone_number": "number",
"address": "jln my address",
"date": "2022-06-06T17:52:40.361Z",
"point": 100,
"status": "user",
"historypoint": [{
"$oid" : "62996a444bcb549d4dedc7ec"
}],
"penjualanku": [{
"$oid" : "62996b164bcb549d4dedc802"
}],
}]
}
]
}
- Method : POST
- Endpoint :
{host}/admin/user/:userId
Header :
type : API Key
key : token
value : your token
Response :
{
"message": "success",
"user": {
"_id": "629e3f2adef49892ddbc8139",
"fullname": "mamank loak",
"email": "mamank@bangkit.academy",
"password": "encrypted",
"phone_number": "number",
"address": "jln my address",
"date": "2022-06-06T17:52:40.361Z",
"point": 0,
"status": "user",
"historypoint": [],
"penjualanku": []
}
}
- Method : PUT/PATCH
- Endpoint :
{host}/admin/user/:userId
Header :
type : API Key
key : token
value : your token
Body :
{
"password" : "dafa",
"point" : 1000
}
Response :
{
"message": "success"
}
- Method : DELETE
- Endpoint :
{host}/admin/user/:userId
Header :
type : API Key
key : token
value : your token
Response :
{
"message": "success"
}
- Method : GET
- Endpoint :
{host}/admin/selling/
Header :
type : API Key
key : token
value : your token
Response :
{
"message": "success",
"listSelling": [
{
"_id": "629d5ddf22de1d096806f88d",
"total_trash": 10,
"total_point": 1000,
"status": "Menunggu penjemputan",
"nameTrash": "plastik PE",
"photoUrl": "https://url/uploads/images/goloak_sell_1654480351_UloVoL.jpg",
"fileSize": "77.91 KB",
"createAt": "2022-06-06T01:52:10.092Z",
"pengguna": "6297d522cbb5dad32159f56b"
}
]
}
- Method : POST
- Endpoint :
{host}/admin/user/:sellingId
Header :
type : API Key
key : token
value : your token
Response :
{
"message": "success",
"trash": {
"_id": "629d5ddf22de1d096806f88d",
"total_trash": 10,
"total_point": 1000,
"status": "Menunggu penjemputan",
"nameTrash": "plastik PE",
"photoUrl": "https://url/uploads/images/goloak_sell_1654480351_UloVoL.jpg",
"fileSize": "77.91 KB",
"createAt": "2022-06-06T01:52:10.092Z",
"pengguna": "6297d522cbb5dad32159f56b"
}
}
- Method : PUT/PATCH
- Endpoint :
{host}/admin/user/:sellingId
Header :
type : API Key
key : token
value : your token
Body :
{
"status" : "Sedang dikonfirmasi"
}
Response :
{
"message": "success"
}
- Method : DELETE
- Endpoint :
{host}/admin/user/:sellingId
Header :
type : API Key
key : token
value : your token
Response :
{
"message": "success"
}
- Method : GET
- Endpoint :
{host}/admin/trash/
Header :
type : API Key
key : token
value : your token
Response :
{
"message": "success",
"listTrash": [
{
"_id": "6295c76f011ee4beed8c1507",
"name": "botol kaca",
"type": "kaca",
"description": "botol kaca....",
"price": 1200,
"image": "https://url/img.jpg",
"fileSize": "77.14 KB"
}
]
}
- Method : POST
- Endpoint :
{host}/admin/trash/:trashId
Header :
type : API Key
key : token
value : your token
Response :
{
"message": "success",
"trash": {
"_id": "6295c76f011ee4beed8c1507",
"name": "botol kaca",
"type": "kaca",
"description": "botol kaca...",
"price": 1200,
"image": "https://url/img.png",
"fileSize": "77.14 KB"
}
}
- Method : PUT/PATCH
- Endpoint :
{host}/admin/trash/:trashId
Header :
type : API Key
key : token
value : your token
Body :
{
"name": "botol kaca sedang",
"type": "kaca",
"description": "botol kaca sedang dan sejenisnya boleh di jual",
"price": 2000
}
Response :
{
"message": "success"
}
- Method : DELETE
- Endpoint :
{host}/trash/user/:trashId
Header :
type : API Key
key : token
value : your token
Response :
{
"message": "success"
}