Skip to content

Latest commit

 

History

History
237 lines (169 loc) · 4.56 KB

README.md

File metadata and controls

237 lines (169 loc) · 4.56 KB

AboutTech StackHow it worksEndpointsDocumentationAuthorsLicense

ℹ️ 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": "example@email.com"
}

Response 201 (application/json)

[
 {
    "id": "user_id",
    "email": "example@email.com",
    "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": "example@email.com",
      "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 🇧🇷