Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/himanshuraj98/speak-chat-app
A real-time chat application built using Node.js, Express.js, and Socket.io on the server-side, and HTML, JavaScript, and the Socket.io client library on the client-side.
https://github.com/himanshuraj98/speak-chat-app
cors express-js nodejs reactjs socket-io
Last synced: 4 days ago
JSON representation
A real-time chat application built using Node.js, Express.js, and Socket.io on the server-side, and HTML, JavaScript, and the Socket.io client library on the client-side.
- Host: GitHub
- URL: https://github.com/himanshuraj98/speak-chat-app
- Owner: HimanshuRaj98
- Created: 2023-09-10T22:33:33.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-14T20:10:14.000Z (over 1 year ago)
- Last Synced: 2024-11-22T07:08:44.915Z (2 months ago)
- Topics: cors, express-js, nodejs, reactjs, socket-io
- Language: JavaScript
- Homepage:
- Size: 83 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Speak-Chat-App
## Real-Time Chat ApplicationThis is a simple real-time chat application using Node.js, Express, and Socket.io. It includes both server-side and client-side code.
## Server-side
### Technologies Used
- Node.js
- Express.js
- Socket.io
- CORS (Cross-Origin Resource Sharing)### Getting Started
1. Clone this repository to your local machine.
2. Install the required Node.js packages:3. Run the server:
```javascript
const express = require("express");
const app = express();
const http = require("http");
const cors = require("cors");
const { Server } = require("socket.io");
const PORT = 5000;app.use(cors());
const server = http.createServer(app);
const io = new Server(server, {
cors: {
origin: "http://localhost:5173",
methods: ["GET", "POST"],
},
});io.on("connection", (socket) => {
console.log(`A user connected: ${socket.id}`);socket.on("send-message", (messages) => {
console.log(messages);
io.emit("group-message", messages);
});socket.on("disconnect", () => {
console.log("User Disconnected");
});
});server.listen(PORT, () => {
console.log(`Server Running At Port ${PORT}`);
});
```## Client-side
**Technologies Used**
- HTML
- JavaScript
- Socket.io client library