diff --git a/README.md b/README.md new file mode 100644 index 0000000..69dff33 --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +# 📝 Chat App + +🚀 This is the updated version of the previous **T-Chat**, released on this repository. + +A real-time chat application with one-to-one messaging, file sharing, and emoji support. + +## 🚀 Features +- 📩 **One-to-One Chat**: Private messaging between users. +- 😀 **Emoji Support**: Express yourself with emojis. +- 🟢 **Online Status**: See when users are online. +- 🏠 **Real-Time Communication**: Powered by Socket.io. +- 📸 **profile picture support**: + and more + +## 🛠️ Tech Stack +- **Frontend:** HTML, CSS, JavaScript, Bootstrap, jQuery +- **Backend:** Node.js, Express.js +- **Database:** MongoDB (Mongoose) +- **Real-Time:** Socket.io + + +## 🌍 Live Demo +Check out the live version: [here](https://t-messanger.onrender.com) + + +## 📸 Screenshots +![Chat App Screenshot](https://github.com/user-attachments/assets/6b4d6ccc-9767-4441-ae98-1c64dae5ca92) + +## 💡 Suggestions & Improvements +If you have any suggestions or want to see improvements, feel free to open an issue or reach out! + +## 🤝 Contributing + +1. Fork the repository +2. Create a new branch (`git checkout -b feature-branch`) +3. Commit your changes (`git commit -m 'Add new feature'`) +4. Push to the branch (`git push origin feature-branch`) +5. Open a Pull Request diff --git a/client/README.md b/client/README.md new file mode 100644 index 0000000..69dff33 --- /dev/null +++ b/client/README.md @@ -0,0 +1,38 @@ +# 📝 Chat App + +🚀 This is the updated version of the previous **T-Chat**, released on this repository. + +A real-time chat application with one-to-one messaging, file sharing, and emoji support. + +## 🚀 Features +- 📩 **One-to-One Chat**: Private messaging between users. +- 😀 **Emoji Support**: Express yourself with emojis. +- 🟢 **Online Status**: See when users are online. +- 🏠 **Real-Time Communication**: Powered by Socket.io. +- 📸 **profile picture support**: + and more + +## 🛠️ Tech Stack +- **Frontend:** HTML, CSS, JavaScript, Bootstrap, jQuery +- **Backend:** Node.js, Express.js +- **Database:** MongoDB (Mongoose) +- **Real-Time:** Socket.io + + +## 🌍 Live Demo +Check out the live version: [here](https://t-messanger.onrender.com) + + +## 📸 Screenshots +![Chat App Screenshot](https://github.com/user-attachments/assets/6b4d6ccc-9767-4441-ae98-1c64dae5ca92) + +## 💡 Suggestions & Improvements +If you have any suggestions or want to see improvements, feel free to open an issue or reach out! + +## 🤝 Contributing + +1. Fork the repository +2. Create a new branch (`git checkout -b feature-branch`) +3. Commit your changes (`git commit -m 'Add new feature'`) +4. Push to the branch (`git push origin feature-branch`) +5. Open a Pull Request diff --git a/client/public/script/script.js b/client/public/script/script.js index 92ad52f..688d86a 100644 --- a/client/public/script/script.js +++ b/client/public/script/script.js @@ -1,4 +1,4 @@ -const socket = io("http://localhost:5000", { +const socket = io("https://t-chat-server.onrender.com", { transports: ["websocket", "polling"], }); diff --git a/server/server.js b/server/server.js index e2c7e71..0084bca 100644 --- a/server/server.js +++ b/server/server.js @@ -9,16 +9,18 @@ import variables from "./config/env.js"; await connectDB(); -const origin = "t-messanger.onrender.com"; //set origin to enable cors for it +const origin = ["https://t-messanger.onrender.com","http://localhost:8081"]; //set origin to enable cors for it const app = express(); const server = http.createServer(app); +app.use(cors({ origin: origin, methods: ["GET", "POST"] })); // Enable CORS for Express requests + app.use(auth); //handles authentication requests app.use(router); //handles normal requests -app.use(cors({ origin: origin, methods: ["GET", "POST"] })); // Enable CORS for Express requests + const io = new Server(server, { // Enable CORS for Socket.io