after cloning this repo
$ docker-compose build
$ docker-compose up
$ docker-compose run app rails db:migrate
-
Access API through:
http://localhost:3001
import app_chat_system_rails_5.postman_collection.json file from parent directory to postman desktop or check this link and click Run in Postman button -
Access database through:
localhost:3307
Database: app
User: user
Password: password
https://documenter.getpostman.com/view/12933230/UyxdKUR9
in order to optimize time for serving chat and messages creation requests which is considered to be many and to be served concurrently.
1️⃣ a queuing system using Redis is used as temporary data store for generating the needed chat and message number for response without contacting the main database (MySQL)
2️⃣ Active Jobs is used to perform saving chats and messages from the temp data in redis later after serving the request and then update Applications and Chats coulmns chat_count and message_count is performed in the background
Method | URL | Request Body |
---|---|---|
GET |
/applications/:application_token/chats/:chat_number/messages | |
POST |
/applications/:application_token/chats/:chat_number/messages | {"msg_body": "value"} |
GET |
/applications/:application_token/chats/:chat_number/messages/:id | |
PUT |
/applications/:application_token/chats/:chat_number/messages/:id | {"msg_body": "value"} |
GET |
/applications/:application_token/chats | |
POST |
/applications/:application_token/chats | |
GET |
/applications/:application_token/chats/:id | |
GET |
/applications | |
POST |
/applications | {"name": "value"} |
GET |
/applications/:token | |
PUT |
/applications/:token | {"name": "value"} |
GET |
/applications/:application_token/chats/:chat_number/search/messages?q=:query |