This repository contains the code for a chat app API built with ExpressJS and MongoDB.
This project was built to learn about building real time communication systems, my goal here was to successfully build an API that can be implemented for an app where two or more people could communicate in real time over a network. The result was a full stack app with Express.
- Clone the repository
- Navigate to the project's folder
- Install dependencies:
npm install
- Run development
npm run start
- Run watch mode
npm run start:dev
Creates a new User.
Request Example:
POST /user
Body
{
"name": "exampleName",
"password": "examplePass",
"email": "exampleEmail",
}
Returns all Users.
Request Example:
GET /user
Creates a new chat.
Request Example:
POST /chat
Body
{
"users": [
{
"_id": "someUserId"
},
{
"_id": "someUserId"
}
],
}
Returns all Chats from a given userId.
Request Example:
GET /chat/someUserId
Creates a new message.
Request Example:
POST /message
Body
{
"chat": "someChatId",
"user": "someUserId",
"message": "Hello World",
}
Returns all messages from a given chatId.
Request Example:
GET /message/chatId
Updates a message given a message Id.
Request Example:
PATCH /message/someMessageId
Body
{
"message": "updated message",
}
Deletes a message given its Id.
Request Example:
DELETE /message/messageId