This is the server-side implementation of a chat application. It handles user connections, message broadcasting, and other backend functionalities required for a real-time chat application.
- User authentication and authorization
- Real-time messaging
- Message history storage
- User presence tracking
- Friendship management
- Node.js
- Express.js
- WS
- MongoDB
-
Clone the repository:
git clone https://github.com/Tgodmuna/chat_app_server.git
-
Navigate to the project directory:
cd chat_app_server -
Install dependencies:
npm install
-
Start the server:
node server.js
-
The server will be running on
http://localhost:7000.
POST /api/auth/register- Register a new userPOST /api/auth/sign-in- Authenticate a userPOST /api/auth/logout- Logout a userGET /api/auth/me- Get the currently authenticated user's profile
GET /api/user/details/:id- Get user profile by IDPUT /api/user/update/:id- Update user profile by IDPOST /api/user/profile/upload- Upload user profile pictureGET /api/user/profile/pic- Get user profile pictureGET /api/user/friends_list- Get user friend listPATCH /api/user/friend_list/unfriend/:friend_id- Remove a friend from the listGET /api/user/friend_requests- Get user friend requests
POST /api/friend/request- Send a friend requestPOST /api/friend/accept- Accept a friend requestPOST /api/friend/block-user- Block a userPATCH /api/friend/rejected- Reject a friend request
GET /api/messages/message/:conversationID- Get messages for a conversationPATCH /api/messages/mark-read/:messageID/:conversationID- Mark a message as readPATCH /api/messages/mark-read/all/:conversationID- Mark all messages as readDELETE /api/messages/delete-message/:messageID- Delete a message
GET /api/conversations/conversations- Get all conversations user is involved inDELETE /api/conversations/delete-conversation/:conversationID- Delete a conversation
connection- When a user connectsdisconnect- When a user disconnectsmessage- When a user sends a messagefriendRequestSent- When a friend request is sentfriendRequestAccepted- When a friend request is accepteduserBlocked- When a user is blockedmessageRead- When a message is read
- Fork the repository
- Create a new branch (
git checkout -b feature-branch) - Commit your changes (
git commit -m 'Add some feature') - Push to the branch (
git push origin feature-branch) - Open a pull request
This project is licensed under the MIT License.
For any inquiries, please contact [email protected].