Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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)