Skip to content

Api RESTFUL para chat em tempo real, no qual voce pode criar, modificar e deletar mensagens.

License

Notifications You must be signed in to change notification settings

LucasDevSystem/realtime-chat-CRUD

Repository files navigation

realtime-chat-CRUD

Description | Run | Author

Description 

This is a real-time message chat server, you can create message, read, modify and delete.I hope you enjoy it : )


Running

*Set up yout docker postgres database

Lets Play

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"
	},
]

Author

Lucas Emanuel, development intern.

About

Api RESTFUL para chat em tempo real, no qual voce pode criar, modificar e deletar mensagens.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published