composer install
cp .env.example .env
buka dan setting .env nya yaitu
Sesuaikan Databasenya
ganti BROADCAST_DRIVER=log menjadi BROADCAST_DRIVER=pusher
Sesuaikan Data Pusher
php artisan key:generate
php artisan jwt:secret
php artisan migrate:fresh --seed
sesuaikan file .env.docker.example
docker compose up -d --build
docker exec -it api_chat_app /bin/sh
php artisan migrate:fresh --seed
docker compose down --rmi=all
Jika Sudah Memasang Api Chatnya Silahkan Lanjutkan pemasangan Frontendnya ya itu Web Chat
1. username: user1
1. password: user1
2.username: user2
2.password: user2
Request :
-
Method : POST
-
Endpoint :
/api/login
-
Body :
{ "username" : "required", "password" : "required" }
Response :
{
"token" : "secret api key"
}
Request :
-
Method : POST
-
Endpoint :
/api/login
-
Body :
{ "username" : "required", "password" : "required" }
Response :
{
"message": "user berhasil di buat"
}
Request :
- Method : GET
- Endpoint :
/api/all-user
Response :
{
"data": [
{
"username": "user1"
},
{
"username": "user2"
}
]
}
Request :
- Header :
- Content-Type : "application/json"
- Accept : "application/json"
- Authorization : "Bearer " + "your secret api key"
Request :
- Method : GET
- Endpoint :
/api/user
Response :
{
"data" : {
"id": 1,
"name": "user1",
"username": "user1",
"created_at": "2021-05-13T15:38:47.000000Z",
"updated_at": "2021-05-13T15:39:03.000000Z"
}
}
Request :
- Method : POST
- Endpoint :
/api/logout
Response :
{
"message": "user berhasil logout"
}
Request :
- Method : GET
- Endpoint :
/api/close/window
Response :
{
"message": "user berhasil di update"
}
Request :
- Method : GET
- Endpoint :
/api/check/online
Response :
[
{
"id": 2,
"status": "13/05/2021 22:46"
}
]
Request :
- Method : GET
- Endpoint :
/api/contact
Response :
{
"data": [
{
"id": 1,
"friend": {
"id": 2,
"name": "user2",
"username": "user2",
"terakhir_dilihat": "13/05/2021 22:46",
"pesan_terakhir": null,
"as_pesan": "penerima",
"read_at": null
},
"status": "diterima",
"created_at": "2021-05-13T15:39:01.000000Z",
"updated_at": "2021-05-13T15:39:11.000000Z"
}
]
}
Request :
-
Method : POST
-
Endpoint :
/api/contact
-
Body :
{ "friend": "username user" }
Response :
{
"message": "contact pertemanan berhasil di kirim"
}
Request :
- Method : GET
- Endpoint :
/api/contact/proses
Response :
{
"data": [
{
"id": 2,
"friend": {
"id": 4,
"name": "user3",
"username": "user3",
"terakhir_dilihat": "14/05/2021 10:45",
"pesan_terakhir": null,
"as_pesan": "penerima",
"read_at": null
},
"status": "proses",
"created_at": "2021-05-14T03:46:11.000000Z",
"updated_at": "2021-05-14T03:46:11.000000Z"
}
]
}
Request :
- Method : GET
- Endpoint :
/api/contact/tolak
Response :
{
"data": [
{
"id": 2,
"friend": {
"id": 4,
"name": "user3",
"username": "user3",
"terakhir_dilihat": "14/05/2021 10:45",
"pesan_terakhir": null,
"as_pesan": "penerima",
"read_at": null
},
"status": "ditolak",
"created_at": "2021-05-14T03:46:11.000000Z",
"updated_at": "2021-05-14T03:54:45.000000Z"
}
]
}
Request :
- Method : GET
- Endpoint :
/api/contact/konfirmasi
Response :
{
"data": [
{
"id": 2,
"friend": {
"id": 1,
"name": "user1",
"username": "user1",
"terakhir_dilihat": "2021-05-14T03:28:19.000000Z"
},
"status": "proses",
"created_at": "2021-05-14T03:46:11.000000Z",
"updated_at": "2021-05-14T03:46:11.000000Z"
}
]
}
Request :
-
Method : PATCH
-
Endpoint :
/api/konfirmasi/{user_id}
-
Body :
{ "status": "ditolak|diterima" }
Response :
{
"message": "contact berhasil di ditolak atau diterima"
}
Request :
- Method : GET
- Endpoint :
/api/message/read-message/{user_id}
Response :
{
"message": "message berhasil di read semua"
}
Request :
- Method : GET
- Endpoint :
/api/message/user/{user_id}
Response :
{
"id": 1,
"name": "user1",
"username": "user1",
"terakhir_dilihat": "online"
}
Request :
- Method : GET
- Endpoint :
/api/message/{user_id}?skip=0
Response :
{
"data": [
{
"id": 1,
"pengirim": 1,
"penerima": 2,
"pesan": "saasas",
"read_at": "14/05/2021 19:40",
"created_at": "14/05/2021 19:40",
"timestamp": 1620996009,
"time": "19.40"
}
]
}
Request :
-
Method : POST
-
Endpoint :
/api/message/{user_id}
-
Body :
{ "pesan" : "required" }
Response :
{
"message": {
"pengirim": 2,
"penerima": "1",
"pesan": "hallo bro",
"updated_at": "2021-05-14T12:56:58.000000Z",
"created_at": "2021-05-14T12:56:58.000000Z",
"id": 9
}
}