This is a simple application that provides semi-real-time chatting functionality. It emulates a single chatroom, where users can post and receive messages. No channels, no extra fluff.
If you do have Docker, follow these instructions:
- Clone this repository. You should automatically be in the
onboarding
branch. - Run
docker-compose build
. - Run
docker-compose up
.
If you do NOT want to use Docker or you do not have it, follow these instructions:
- Clone this repository. You should automatically be in the
onboarding
branch. - If you do not have
yarn
, please runnpm install -g yarn
. - Run
cd frontend
- Run
yarn install
- Run
yarn start
Your job is to add send message functionality back to the website. Right now, you can change your name and view messages in real-time, but you are unable to send messages.
Only file you should modify:
- frontend/src/components/MessageForm.js
Files you might find helpful:
- frontend/src/components/NameForm.js
- frontend/src/components/MessageList.js
- frontend/src/pages/Home.js
The backend has already been completed for you and is live here. A brief description of the API that it supports is given below. Hint: you will only need to look at the POST method!
-
GET /api/messages?limit={LIMIT}&after={DATE}: The after and limit arguments are optional. The limit parameter limits the number of messages that are returned. The after parameter sets a minimum date for messages; all returned messages must have a creation date occurring AFTER the given date.
Returns
{ success: true, data: [...] }
on success.Returns
{ error: true, message: '...' }
on error. -
POST /api/messages: Body of the message must be of the format
{ "sender" : "...", "content" : "..."}
where sender is the name of the sender and content is the content of the message.Returns
{ success: true }
on success.Returns
{ error: true, message: '...' }
on error.