Skip to content

Ctere1/mern-stack-server

Repository files navigation

Mern Stack Chat App Server

MongoDB Express.js React NodeJS

IntroductionInstallation GuideAPI ReferenceCreditsLicenseContributors

GitHub Repo stars GitHub forks GitHub watchers

ℹ️Introduction

Chat Application that you can chat with application's users using MERN STACK.

Authentication process is performed using OAuth 2.0.

For Client Side see: Mern Stack Chat App Client

💾Installation Guide

To clone and run this application, you'll need Git and Node.js (which comes with npm) installed on your computer. From your command line:

# Clone this repository
$ git clone https://github.com/Ctere1/mern-stack-server
# Go into the repository
$ cd mern-stack-server
# Install dependencies
$ npm install
# Run the app
$ npm start

Do not forget setup .env file for MongoDB connection and Google Signin.

⚡API

See Postman Collection Json for detailed information.

Authentication Endpoints

HTTP Verb Endpoint Description
POST api/auth/login User Login
DELETE api/auth/logout User Logout
POST api/auth/googleLogin Login with Google's Credentials
POST api/auth/googleSignup Signup with Google's Credentials
POST api/auth/refreshToken For OAuth 2.0

User Endpoints

HTTP Verb Endpoint Description
POST api/user/signup User signup
GET api/user/all Returns Users
DELETE api/user/delete Deletes the User
PUT api/user/update Updates the User
PUT api/user/referral Updates user's point

Room Endpoint

HTTP Verb Endpoint Description
GET api/room Returns Rooms

👤User Data Example

{
   "_id": "63b06ea4afbce25ff3e6fe91",
   "createdAt": "2022-12-31",
   "name": "Test",
   "email": "test@gmail.com",
   "picture": "http://res.cloudinary.com/dyzuhnuw6/image/upload/v1672507041/xgiokrhmylqzwblq7hql.png",
   "status": "online",
   "points": 0,
   "referralCode": "gYSTs",
   "referralFromCode": "",
   "newMessages": {},
   "__v": 0
}

🏠Room Data Example

[
    "general",
    "welcome",
    "events",
    "meeting"
]

🪪Get Token Data Example

{
   "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2CJleHAiOjE2NzI1OTEwNjF9.7M0htpNmxcgAJuAMC0E_tWn3FMvSgJi5qZ9lD0ZvsNY",
   "refreshToken": "eyJhbGciOiJIUI1NiIsInR5cCI6IkpXVCJ9.eyJ1cTYxLCJleHAiOjE2NzI1OTEzNjF9.kx0Cg8gIKc0by6o14zoVp0FRoWDcx0PI44wvfk0CNlk"
}

📝Credits

This software uses the following open source packages:

©License

GitHub

📌Contributors