Ruby on Rails Chat-RestApi running on Docker using mysql, redis, sidekiq, elasticsearch.
- Ruby v2.7
- Rails v5
- Elasticsearch 7.17
- Mysql 5.7
- Redis 5.0
- sideKiq
- Docker
- Docker compose
$ docker compose up -d --build
Docker will expose Port: 3001
run in Host: localhost
🥳
The REST API to the chat app is described below.
GET /api/v1/applications
"status": "SUCCESS",
"data": [
{
"name": "app_redis 1",
"app_key": "Qo6sxrAudRKd2aDPm4PM3Xw9",
"chat_count": 8,
"created_at": "2022-06-11T16:55:29.000Z",
"updated_at": "2022-06-11T18:50:02.000Z"
}
]
POST /api/v1/applications/
{
"name": "<App name>"
}
"status": "SUCCESS",
"data": [
{
"name": "<App name>",
"app_key": "<App Token>",
"chat_count": <Chat Count>,
"created_at": "<Created Date>",
"updated_at": "<Updated Date>"
}
]
PATCH /api/v1/applications/{app_key}
{
"name": "<App name>"
}
"status": "SUCCESS",
"data": [
{
"name": "<App name>",
"app_key": "<App Token>",
"chat_count": <Chat Count>,
"created_at": "<Created Date>",
"updated_at": "<Updated Date>"
}
]
GET /api/v1/applications/{app_key}/chats
{
"data": [
{
"number": 1,
"message_count": 4,
"created_at": "2022-06-11T16:55:46.000Z",
"updated_at": "2022-06-11T17:00:03.000Z"
},
{
"number": 2,
"message_count": 2,
"created_at": "2022-06-11T16:55:47.000Z",
"updated_at": "2022-06-11T18:52:03.000Z"
}
}
GET /api/v1/applications/{app_key}/chats/{chat_number}
{
"data": [
{
"number": 1,
"message_count": 4,
"created_at": "2022-06-11T16:55:46.000Z",
"updated_at": "2022-06-11T17:00:03.000Z"
},
}
POST /api/v1/applications/{app_key}/chats
{
"number": `<new chat number>`
}
GET /api/v1/applications/{app_key}/chats/{chat_number}/messages
{
"STATUS": "SUCCESS",
"messages": [
{
"body": "message content",
"created_at": "2022-06-11T16:56:08.000Z",
"updated_at": "2022-06-11T16:56:08.000Z"
},
{
"body": "message content",
"created_at": "2022-06-11T16:56:11.000Z",
"updated_at": "2022-06-11T16:56:11.000Z"
},
{
"body": "message content",
"created_at": "2022-06-11T16:56:13.000Z",
"updated_at": "2022-06-11T16:56:13.000Z"
},
{
"body": "message content",
"created_at": "2022-06-11T16:56:17.000Z",
"updated_at": "2022-06-11T16:56:17.000Z"
}
]
}
POST /api/v1/applications/{app_key}/chats/{chat_number}/messages
{
"STATUS": "SUCCESS",
{
"number": `<message number>`
"body": "message content",
"created_at": "2022-06-11T16:56:08.000Z",
"updated_at": "2022-06-11T16:56:08.000Z"
}
}
}
GET /api/v1/applications/{app_key}/chats/{chat_number}/search?query={keyword}
[
{
"body": "{keyword}",
"created_at": "2022-06-11T16:56:17.000Z",
"updated_at": "2022-06-11T16:56:17.000Z"
}
]