A very basic in-memory back-end for storing and retreiving chat messages. There is no authentication. This is purely for educational purposes.
The server uses JSON to send and receive information.
You may use the following URL to access the API: http://chat.codefriends.larner.com.
The server has two endpoints: one to store new messages and another to retreive messages.
POST /message
message(string, required) the message that should be stored on the server.user(string, required) the username of the message creator
{
"message": "hello world!",
"user": "anonymous123"
}
GET /messages
afterId(integer, optional) only return messages that were created after this id. If this value is not specified then all messages will be returned.
GET /messages?afterId=7
[
{
"id": 8,
"user": "aaron",
"message": "hello world!",
"createdAt": "2020-08-20T18:16:05.822Z"
},
{
"id": 9,
"user": "anonymous123",
"message": "hi aaron!",
"createdAt": "2020-08-20T18:36:05.822Z"
}
]
git clone https://github.com/alarner/chat-server.gitcd chat-servernpm i
npm run dev
npm start