Giter Site home page Giter Site logo

chat-backend's Introduction

Recovered version of PDP project

Initial repo was accidentally deleted both localy and remotely.
In this one I tried to recover most of the parts ASAP
But due to lack of time was only able to rewrite some main parts such as:

  • Creation of users, chats and messages
  • described their relationships in DB
  • setup DB

In other words this project is not yet finished but since it will be a part of my full-stack app I'll continue working on it and cover all other parts such as:

  • authentication / authorization
  • additional features for messages
  • etc.

Prerequisites

  • Docker Desktop installed
  • Postman installed (or web version)
  • yarn installed

Installation

git clone https://github.com/1nspir3d/chat-backend.git
cd chat-backend
yarn

Above steps will clone project's repo and install required dependencies
Next step is to launch Docker Desktop and Postman
Make sure both applications up and running and then proceed to the next step

Database

In order for this project to work you have to create database container using following command:

yarn run db:create

This will create and start database container

Later on you won't need to create it again and can use following command to start previously created container:

yarn run db:start

But if by any reason you deleted mentioned container you have to create it again

Server

yarn run start:dev

Postman

Now when database and server are running we can test our endpoints
Open Postman and import chat-backend.postman_collection.json file which can be found in the root of this project

image

This collection has pre-written requests for users and chats endpoints

In order to test messages you have to create a new WebSocket request

image

image

Make sure you have selected Socket.IO instead of Raw, have the right server URL entered, JSON selected as the type of composed message, Acknowledgement enabled and existing event name entered in the input field

Server URL - http://localhost:3000/messages
List of available event names:

  • createMessage
  • findAllMessages
  • findOneMessage
  • updateMessage

Example of composed messages for each event:

  • createMessage
    {
      "value": "New message",
      "authorId": "get id from user",
      "chatId": "get id from chat",
      // this value should be generated on the front-end side but for testing purpose you can enter any number
      "createdAt": 12314123123 
    }
  • findOneMessage
    {
      "id": "get id of the message"
    }
  • updateMessage
    {
      "id": "get it of the message",
      "value": "updated message"
    }

chat-backend's People

Contributors

1nspir3d avatar davydveremchuk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.