Welcome to the backend of a real-time chat application! π This backend is powered by Node.js, Express, MongoDB, and Socket.IO to provide a seamless, scalable chat experience.
- Real-time messaging using Socket.IO
- User authentication & authorization with JWT tokens
- Persistent chat history stored in MongoDB
- RESTful API for managing users and messages
- Node.js β JavaScript runtime for building the backend
- Express β Web framework for Node.js
- MongoDB β NoSQL database for storing users and messages
- Socket.IO β Real-time bi-directional communication
- Clone the repository:
git clone https://github.com/Prakhar-code/Chat-App-Backend.git
- Navigate to the project directory:
cd Chat-App-Backend
- Install the dependencies:
npm install
- Create a
.env
file in the root directory. - Add the following environment variables to the
.env
file:MONGODB_URI=your_mongodb_connection_string JWT_SECRET=your_secret_key
- Start the development server:
npm run dev
- The backend will be running on http://localhost:5001.
POST /api/auth/signup
β Register a new userPOST /api/auth/login
β Log in an existing userGET /api/users
β Fetch all usersGET /api/messages
β Fetch all messagesPOST /api/messages
β Send a new message
Feel free to open issues or create pull requests if you'd like to contribute to the project. Contributions are always welcome!