- Application
- Chat
- Message
3. Used RabbitMQ in to handle the creation of the applications, chats and messages. To handle race conditions, the create requests are submitted to the queue which then processes them.
4. The auto generated application token is created by creating a random key and appending the application name to it.
5. The chat_count and message_count fileds are updated whenever a chat or a message is created respectivly.
- MySQL Databse
- RabbitMQ
- Rails Server
- Elasticsearch
- Redis
$ curl -X POST \
http://localhost:3000/api/v1/applications \
-H 'content-type: application/json' \
-d '{
"name":"testApp"
}'
$ curl -X GET \
http://localhost:3000/api/v1/applications
:token is the generated token in the response of the create new application request
$ curl -X GET \
http://localhost:3000/api/v1/applications/:token
:token is the generated token in the response of the create new application request
$ curl -X POST \
http://localhost:3000/api/v1/applications/:token/chats \
-H 'content-type: application/json' \
-d '{
"description":"testing chats"
}'
:token is the generated token in the response of the create new application request
$ curl -X GET \
http://localhost:3000/api/v1/applications/:token/chats
:token is the generated token in the response of the create new application request
:number is the generated number in the response of the create new chat request
$ curl -X GET \
http://localhost:3000/api/v1/applications/:token/chats/:number
:token is the generated token in the response of the create new application request
:number is the generated number in the response of the create new chat request
$ curl -X POST \
http://localhost:3000/api/v1/applications/:token/chats/:number/messages \
-H 'content-type: application/json' \
-d '{
"body":"an example of a message"
}'
:token is the generated token in the response of the create new application request
:number is the generated number in the response of the create new chat request
$ curl -X GET \
http://localhost:3000/api/v1/applications/:token/chats/:number/messages
:token is the generated token in the response of the create new application request
:number is the generated number in the response of the create new chat request
:messageNumber is the generated number in the response of the create new message request
$ curl -X GET \
http://localhost:3000/api/v1/applications/:token/chats/:number/messages/:messageNumber
:token is the generated token in the response of the create new application request
:number is the generated number in the response of the create new chat request
$ curl -X POST \
http://localhost:3000/api/v1/applications/:token/chats/:number/search \
-H 'content-type: application/json' \
-d '{
"query":"examp"
}'