This is a chat API written in Node, Express, React, and Mongo. Now with ES6.
- Node v7.8 (Built on 7.8, should build on earlier versions)
- MongoDB (I'd recommend using Homebrew to install)
- Yarn (Also recommend using Homebrew)
- Clone this repo
yarn install
- Make a directory for MongoDB
mkdir mongostore
mongod --dbpath mongostore/
- MongoDB should now be running (Keep in terminal)
yarn dev:wds
- to start webpack hot reloader (Do this in a separate terminal)yarn start
- start express and react frontend (Do this in a separate terminal)- Servers should be loaded
- Visit
localhost:8000
to view front end - API calls are made on
localhost:8000/thread
- Visit
- Ensure MongoDB is running. Do step 3 above if not.
yarn test
Start a new conversation and grab the chat ID. Give the chat ID to other user, have them enter the ID in to join and begin chatting.
-
POST /thread
- Creates a new thread
- Params: None
-
GET /thread/:id?offset=0&limit=10
- Gets a thread by ID
- Params (on query):
id: ID of thread
offset: number of messages to offset
limit: limit the number of messages to display
-
DELETE /thread/:id
- Deletes a thread by ID
- Params (on query):
id: ID of thread
-
POST /thread/:id
- Adds a message to a thread
- Params (on query):
id: ID of thread
- Params (on body as JSON):
user: username of user
message: message to be sent