biccsdev / chatApp

This repository contains the source of a chat app made with nodejs, expressjs and mongodb for the backend,

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chat App API

Description

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.

Table of Contents

Installation

  • 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

Diagrams

UML Class Diagram

UMLClass

UML Components Diagram

UMLComponents

APIs

User

POST /user

Creates a new User.

Request Example:

POST /user

Body

{
    "name": "exampleName",
    "password": "examplePass",
    "email": "exampleEmail",
}

GET /user

Returns all Users.

Request Example:

GET /user

Chat

POST /chat

Creates a new chat.

Request Example:

POST /chat

Body

{
    "users": [
        {
            "_id": "someUserId"
        }, 
        {
            "_id": "someUserId"
        }
    ],
}

GET /chat/:userId

Returns all Chats from a given userId.

Request Example:

GET /chat/someUserId

Message

POST /message

Creates a new message.

Request Example:

POST /message

Body

{
    "chat": "someChatId",
    "user": "someUserId",
    "message": "Hello World",
}

GET /message/:chatId

Returns all messages from a given chatId.

Request Example:

GET /message/chatId

PATCH /message/:messageId

Updates a message given a message Id.

Request Example:

PATCH /message/someMessageId

Body

{
    "message": "updated message", 
}

DELETE /message/:messageId

Deletes a message given its Id.

Request Example:

DELETE /message/messageId

About

This repository contains the source of a chat app made with nodejs, expressjs and mongodb for the backend,


Languages

Language:JavaScript 92.2%Language:HTML 7.5%Language:CSS 0.3%