Git Product home page Git Product logo

chat-app's Introduction

Chat App Server

Table of Contents

Introduction

This repository contains the server-side code for the Chat App, which is built using Express.js. The server handles user authentication and messaging functionalities for seamless communication between agents and clients.

Features

  • User registration with username, email, and password
  • User authentication using JWT tokens
  • Account deletion
  • Messaging functionality for agents and clients
  • Real-time messaging using Socket.io

Installation

  1. Clone the repository:
    git clone https://github.com/your-username/chat-app-server.git
    

2 Navigate to the project directory: ```bash cd trai-agencies-api

  1. Install dependencies:
    npm install
    
  2. Create a .env file in the project root and add the following environment variables:
    PORT=8000
    DB_URI=mongodb://your-mongodb-uri
    JWT_SECRET=your-jwt-secret
    
  3. Start the server:
    npm start
    

Usage

  1. Make sure to have MongoDB installed and running.
  2. Use a tool like Postman or a web browser to interact with the API.
  3. Register a user, obtain a JWT token, and include it in the cookies for authenticated requests.
# Chat App Server

## Table of Contents

- [Introduction](#introduction)
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [Endpoints](#endpoints)
- [Dependencies](#dependencies)
- [Author](#author)
- [License](#license)

## Introduction

This repository contains the server-side code for the Chat App, which is built using Express.js. The server handles user authentication and messaging functionalities for seamless communication between agents and clients.

## Features

- User registration with username, email, and password
- User authentication using JWT tokens
- Account deletion
- Messaging functionality for agents and clients
- Real-time messaging using Socket.io

## Installation

1. Clone the repository:
   ```bash
   git clone https://github.com/your-username/chat-app-server.git
  1. Navigate to the project directory:

    cd chat-app-server
  2. Install dependencies:

    npm install
  3. Create a .env file in the project root and add the following environment variables:

    PORT=8000
    DB_URI=mongodb://your-mongodb-uri
    JWT_SECRET=your-jwt-secret
    
  4. Start the server:

    npm start

Usage

  1. Ensure MongoDB is installed and running.
  2. Use tools like Postman or a web browser to interact with the API.
  3. Register users, login to obtain JWT tokens, and use them for authenticated requests.

Endpoints

  • POST /login: User login
  • POST /register: User registration
  • POST /agent/register: Agent registration
  • GET /user/:id: Get information about a specific user
  • POST /sendMessage: Send message from client to agent
  • GET /message: Get all messages
  • POST /message/:id: Update message status
  • GET /message/:id: Get specific message details
  • POST /response: Send response from agent to client
  • GET /agents: Get information about all agents

Dependencies

  • bcrypt: Password hashing library
  • body-parser: Middleware for parsing request bodies
  • cors: Middleware for enabling Cross-Origin Resource Sharing
  • dotenv: Module for loading environment variables from a .env file
  • jsonwebtoken: Library for generating and verifying JSON Web Tokens
  • mongodb: Official MongoDB driver
  • mongoose: MongoDB object modeling tool
  • nodemon: Utility for automatically restarting the server

chat-app's People

Contributors

mikemills254 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.