https://github.com/ahmedmustafamo/chat-api-rails
a simple web api for chats and messages
https://github.com/ahmedmustafamo/chat-api-rails
docker docker-compose elasticsearch mysql rails7 ruby
Last synced: 6 months ago
JSON representation
a simple web api for chats and messages
- Host: GitHub
- URL: https://github.com/ahmedmustafamo/chat-api-rails
- Owner: ahmedmustafamo
- Created: 2024-06-30T11:11:11.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-04T10:26:26.000Z (about 2 years ago)
- Last Synced: 2025-04-07T08:45:07.073Z (about 1 year ago)
- Topics: docker, docker-compose, elasticsearch, mysql, rails7, ruby
- Language: Ruby
- Homepage:
- Size: 72.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# chat-api-rails
A simple chat api built on top of rails7.
## Installation
- type `docker-compose up`
- after the `api` service is up, you can run `make migrate` into another terminal window
I've wrote unit test cases for `ApplicationsController` as a quick sample. To run it, you can execute `make unittest_controllers`
You can find a very useful commands on the `Makefile` "for development purposes only"
To navigate to Swagger, you can locally visit http://localhost:3000/api-docs
## Sample API invocations:
### Application
```
curl -X POST -H "Content-Type: application/json" -d '{"name": "app1"}' http://localhost:3000/applications
```
### Chat
```
curl -X POST -H "Content-Type: application/json" http://localhost:3000/applications/{APP_TOKEN}/chats
```
### Message
Creation
```
curl -X POST -H "Content-Type: application/json" -d '{"content": "Hi John!"}' http://localhost:3000/applications/{APP_TOKEN}/chats/{CHAT_NUIMBER}/messages
```
Searching
Creation
```
curl -X GET -H "Content-Type: application/json" http://localhost:3000/applications/{APP_TOKEN}/chats/{CHAT_NUIMBER}/messages/search/?query={message_str}
```
on `config/environments/development.rb`, you'll find the following hosts list. That's because i'm running my application inside one of my private codespaces. You can remove it if you want
```ruby
config.hosts = [
"localhost:3000",
"vigilant-space-winner-7xpx5qv7vrfrvv-3000.app.github.dev", # For debugging inside codespace
]
```