Skip to content

Chat with Socket.IO of the Next Level Week 5.0 πŸš€

License

Notifications You must be signed in to change notification settings

BiaChacon/chatty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

About β€’ Tech Stack β€’ How it works β€’ Endpoints β€’ Documentation β€’ Authors β€’ License

ℹ️ About

Chat with Socket.IO created at RocketSeat Next Level Week 5.0, using stack TypeScript with Node.js.


πŸ›  Tech Stack

The following tools were used in the construction of the project:


πŸš€ How it works

πŸ‘‰ Pre-requisites

Before you begin, you will need to have the following tools installed on your machine: Git, Node.js and Yarn. In addition, it is good to have an editor to work with the code like VSCode.

🏁 Start

# Clone this repository
$ git clone https://github.com/BiaChacon/chatty.git

# Access the project folder cmd/terminal
$ cd chatty

🎲 Running the server

# go to the api folder
$ cd api

# install the dependencies
$ npm install

#Create migrations
$ yarn typeorm migration:run

# Run the application
$ yarn dev

# The server will start at port: 3333 - go to http://localhost:3333

πŸ–₯️ Endpoints

πŸ’  To access the Admin chat go to πŸ‘‰ http://localhost:3333/pages/admin

πŸ’  To access the Client chat go to πŸ‘‰ http://localhost:3333/pages/client


πŸ—Ž Documentation API

Settings

πŸ“ Create Settings [/settings] [POST]

Request

  • Body
{
    "chat": "true",
    "username": "admin"
}

Response 201 (application/json)

[
  {
    "id": "admin_id",
    "username": "admin",
    "chat": "true",
    "updated_at": "2021-04-22T19:22:37.000Z",
    "created_at": "2021-04-22T19:22:37.000Z"
}
]

πŸ“ Update Settings [/settings/admin] [PUT]

Request

  • Body
{
    "chat": "false"
}

Response 201

User

πŸ“Create User [/users] [POST]

Request

  • Body
{
    "email": "[email protected]"
}

Response 201 (application/json)

[
 {
    "id": "user_id",
    "email": "[email protected]",
    "created_at": "2021-04-22T19:37:24.000Z"
}
]
Message

πŸ“Send Message [/messages] [POST]

Request

  • Body
{
    "user_id": "user_id",
    "text": "message"
}

Response 201 (application/json)

[
  {
    "id": "message_id",
    "text": "message",
    "user_id": "user_id",
    "created_at": "2021-04-23T19:40:02.000Z"
  }
]

πŸ“List Messages By User [/messages/:user_id] [GET]

Response 201 (application/json)

[
  {
    "id": "message_id",
    "admin_id": "admin_id",
    "text": "message",
    "user_id": "user_id",
    "created_at": "2021-04-22T19:40:02.000Z",
    "user": {
      "id": "user_id",
      "email": "[email protected]",
      "created_at": "2021-04-22T19:37:24.000Z"
    }
  }
]

πŸ‘©πŸ½β€πŸ’» Authors


Bia Chacon

πŸ’»

πŸ“ License

This project is under MIT. See at here LICENSE for more information.


README versions

English πŸ‡ΊπŸ‡Έ | Portuguese πŸ‡§πŸ‡·