cp .env.example .env
# Edit .env to add connection URL for mongodb, port for the
# server to run on, and a secret for JWTs
# If yarn is not already installed, install it with
npm install -g yarn
# install dependencies
yarn install
# to run in development mode (with nodemon)
yarn dev
# to run normally
yarn start-
Sign Up
POST /auth/signup- Request body should contain parameters
user_name,user_emailandpassword. - Response will have a JWT to be used for secured routes.
- Request body should contain parameters
-
Login
POST /auth/login- Request body should contain parameters
user_emailandpassword. - Response will have a JWT to be used for secured routes.
- Request body should contain parameters
-
List Users
GET /userandGET /users(Secured route)- Request header must contain
Authorizationwith valueBearer <token>. - Returns array of all users.
- Request header must contain
-
User Profile
GET /user/profile(Secured route)- Request header must contain
Authorizationwith valueBearer <token>.
- Request header must contain
-
List Chats
GET /user/chats(Secured route)- Request header must contain
Authorizationwith valueBearer <token>. - Returns array of all chats the user is a part of.
- Request header must contain
-
Create Chat
POST /user/chats/new(Secured route)- Request header must contain
Authorizationwith valueBearer <token>. - Request body must contain
chat_to, set to_idof the user to chat with.
- Request header must contain
-
View Chat
GET /user/chats/<chatid>(Secured route)- Request header must contain
Authorizationwith valueBearer <token>. - Returns the chat with id
<chatid>
- Request header must contain
-
Send Message
POST /user/chats/<chatid>/send(Seured route)<chatid>is the_idof the chat to send the message to.- Request header must contain
Authorizationwith valueBearer <token>. - Request body must contain
message_text. - At the moment, will return the complete chat history after sending the message.