Skip to content

erickmp07/chatty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chatty

Technologies   |    Project   |    Diagram   |    How to run   |    License

License


Chatty - Client's home page Chatty - Client chat
Chatty - Admin chat

Technologies

This project was developed with the following technologies:

Project

API that implements a chat, using WebSocket, with instant message. Who is going to consume the API can customize some informations like: if the chat will be enabled or not, if the chat will have a default initial message, etc. And registration of users who will access this chat.

The conversation history will be kept so that when the user returns, he will be able to access the oldest messages.

Diagram

Application Diagram

How to run

Locally

Prerequisites:

Download and install Node.js and Yarn.


  • Clone the repository
git clone https://github.com/erickmp07/chatty.git
yarn

To start the server:

yarn dev

The application can be accessed at localhost:3333.

The available routes are:

# GET - Go to the chat page for support
http://localhost:3333/pages/client

# GET - Go to the admin page for support
http://localhost:3333/pages/admin

# POST (JSON) - Create Setting
http://localhost:3333/settings
body: {
    "username": "admin",
    "chat": true
}

# GET - Find Setting by Username
http://localhost:3333/settings/:username

# PUT (Params + JSON) - Update Setting enabling the Chat
http://localhost:3333/settings/:username
body: {
    "chat": true
}

# PUT (Params + JSON) - Update Setting disabling the Chat
http://localhost:3333/settings/:username
body: {
    "chat": false
}

# POST (JSON) - Create User
http://localhost:3333/users
body: {
    "email": "[email protected]"
}

# POST (JSON) - User sends Message
http://localhost:3333/messages
body: {
    "user_id": "user_id",
    "text": "user message"
}

# POST (JSON) - Admin sends Message
http://localhost:3333/messages
body: {
    "user_id": "user_id",
    "text": "admin message",
    "admin_id": "admin_id"
}

# GET - Show all Messages by User
http://localhost:3333/messages/:user_id

Docker container

Prerequisites:

Download and install Docker


  • Pull the image with the command:
docker pull erickmp07/chatty:latest
  • Run the image with the command:
docker run -p 49160:3333 -d erickmp07/chatty

The application can be accessed at localhost:49160.

The available routes are:

# GET - Go to the chat page for support
http://localhost:49160/pages/client

# GET - Go to the admin page for support
http://localhost:49160/pages/admin

# POST (JSON) - Create Setting
http://localhost:49160/settings
body: {
    "username": "admin",
    "chat": true
}

# GET - Find Setting by Username
http://localhost:49160/settings/:username

# PUT (Params + JSON) - Update Setting enabling the Chat
http://localhost:49160/settings/:username
body: {
    "chat": true
}

# PUT (Params + JSON) - Update Setting disabling the Chat
http://localhost:49160/settings/:username
body: {
    "chat": false
}

# POST (JSON) - Create User
http://localhost:49160/users
body: {
    "email": "[email protected]"
}

# POST (JSON) - User sends Message
http://localhost:49160/messages
body: {
    "user_id": "user_id",
    "text": "user message"
}

# POST (JSON) - Admin sends Message
http://localhost:49160/messages
body: {
    "user_id": "user_id",
    "text": "admin message",
    "admin_id": "admin_id"
}

# GET - Show all Messages by User
http://localhost:49160/messages/:user_id

License

Licensed under MIT license.