Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/suzukiryuichiro/message_api
Backend API for React-Redux chat
https://github.com/suzukiryuichiro/message_api
Last synced: 1 day ago
JSON representation
Backend API for React-Redux chat
- Host: GitHub
- URL: https://github.com/suzukiryuichiro/message_api
- Owner: SuzukiRyuichiro
- Created: 2021-04-05T03:22:12.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-04-25T05:08:15.000Z (over 3 years ago)
- Last Synced: 2024-11-09T09:39:49.071Z (about 2 months ago)
- Language: Ruby
- Homepage:
- Size: 1.64 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Welcome to Scooter's message API
This API is a very simple API for messaging among multiple users## How to use
### How to read the messages
GET `https://scooter-messages.herokuapp.com/api/v1/channels/[CHANNEL_NAME]/messages`
This would return all the messages in that channel. If the channel name is invalid (do not exist), it would return an error message.
↓example response↓
![successful response](./screenshots/get.jpg)
↓example response of an invalid request↓
![error response](./screenshots/error.jpg)### How to send a message
POST `https://scooter-messages.herokuapp.com/api/v1/channels/[CHANNEL_NAME]/messages`
Attach a body that contains both a "content" and an "author". If either of them are blank, it would return an error message
If the post request is routed to a new channel name, it would automatically create a channel with the name in the route. (i.e. If a channel called games never existed in the database, post request to `/api/v1/channels/games/message` will create a new channel called games)
↓refer to the example here in Postman (Successful)↓
![example from postman](./screenshots/postman_post.jpg)
↓refer to the example here in Postman (Unsuccessful)↓
![example from postman](./screenshots/post_error.jpg)### How to see open channels
GET `https://scooter-messages.herokuapp.com/api/v1/channels`
You can see all available channel names in the database!
↓example response↓
![successful response](./screenshots/channel_index.jpg)