Description | Run | Author
This is a real-time message chat server, you can create message, read, modify and delete.I hope you enjoy it : )
*Set up yout docker postgres database
First u need start a chat pass your id as "sender_id" and to receiver "receiver_id", the server will identify inexisting inbox and then create inbox and inbox users. method: POST route:"/message"
"body":{
"sender_id": 2,
"receiver_id": 1,
"text": "hey"
}
will return
{
"id": "909f6320-1804-442c-9624-c818d120bbe9",
"inbox_id": "7053c6ee-beff-405a-a31b-72b78bd2bc56",
"sender_id": 2,
"receiver_id": 1,
"text": "hey"
}
You can get user inbox method: GET route:"/inbox"
"params":{
"user":1
}
will return
[
{
"id": "a104a014-d8ba-4869-9f61-3b90d91aaaab",
"last_message": "hey",
"last_sent_user_id": "1"
},
{
"id": "7053c6ee-beff-405a-a31b-72b78bd2bc56",
"last_message": "hru?",
"last_sent_user_id": "1"
},
]
With inbox_id in hand u can find all messages from this inbox method: GET route:"/message"
"params":{
"inbox_id":"a104a014-d8ba-4869-9f61-3b90d91aaaab"
}
will return
[
{
"id": "ddc06c81-4770-4c3b-9ee2-257cfaf32848",
"inbox_id": "a104a014-d8ba-4869-9f61-3b90d91aaaab",
"sender_id": 1,
"receiver_id": 2,
"text": "hey",
"created_at": "2022-08-29T05:26:54.820Z"
},
]
Lucas Emanuel, development intern.