Skip to content

VsalCode/nongtalk-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nongtalk Backend

This is the backend for the Nongtalk application, a chat platform built with Node.js, Express, TypeScript, Prisma, and Socket.IO. It provides APIs for user registration, authentication, friend management, messaging, and profile management.

Tech Stack

  • Node.js: JavaScript runtime for server-side development.
  • Express: Web framework for building RESTful APIs.
  • TypeScript: Adds static types to JavaScript for better scalability.
  • Prisma: ORM for database management.
  • Socket.IO: Enables real-time bidirectional communication for chat features.

API Endpoints

Authentication

Register

POST /auth/register
Host: localhost:5000
Content-Type: application/json

{
  "email": "[email protected]",
  "username": "yassir",
  "password": "12345678"
}

Login

POST /auth/login
Host: localhost:5000
Content-Type: application/json

{
  "email": "[email protected]",
  "password": "12345678"
}

Friends

Add Friend

POST /friends
Host: localhost:5000
Authorization: Bearer <Token>
Content-Type: application/json

{
  "friendCode": "USR834028"
}

Get All Friends

GET /friends
Host: localhost:5000
Authorization: Bearer <Token>

Profile

Get User Profile

GET /profile
Host: localhost:5000
Authorization: Bearer <Token>

Update Profile

PATCH /profile
Host: localhost:5000
Authorization: Bearer <Token>
Content-Type: application/json

{
  "username": "faisal"
}

Messaging

Load Chat History

POST /message
Host: localhost:5000
Authorization: Bearer <Token>
Content-Type: application/json

{
  "friendCode": "USR834028"
}

How to Clone

  1. Clone the repository:
    git clone https://github.com/VsalCode/nongtalk-backend.git
  2. Navigate to the project directory:
    cd nongtalk-backend
  3. Install dependencies:
    npm install
  4. Set up environment variables:
    • Create a .env file in the root directory.
    • Add necessary configurations (e.g., database URL, JWT secret).
    DATABASE_URL="your-database-url"
    JWT_SECRET="your-jwt-secret"
    PORT=5000
  5. Run the application:
    npm run dev

How to Contribute

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix:
    git checkout -b feature/your-feature-name
  3. Make your changes and commit them with a descriptive message:
    git commit -m "Add your commit message"
  4. Push your changes to your fork:
    git push origin feature/your-feature-name
  5. Create a pull request on the main repository.
  6. Ensure your code follows the project's coding standards and passes any tests.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Releases

No releases published

Packages

No packages published