Skip to content

Commit f255f9e

Browse files
authored
Merge pull request #19 from CS3219-AY2425S1/rick/frontend
MS2: Set up Frontend Repo
2 parents 87860c1 + 1a1722d commit f255f9e

40 files changed

+7747
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
.yarn/install-state.gz
8+
9+
# testing
10+
/coverage
11+
12+
# next.js
13+
/.next/
14+
/out/
15+
16+
# production
17+
/build
18+
19+
# misc
20+
.DS_Store
21+
*.pem
22+
23+
# debug
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
28+
# local env files
29+
.env*.local
30+
31+
# vercel
32+
.vercel
33+
34+
# typescript
35+
*.tsbuildinfo
36+
next-env.d.ts
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Real-time Messaging Server
2+
3+
This is a simple server implementation using Socket.io for real-time messaging. The server listens for connections and emits messages to all connected clients.
4+
5+
## Project Overview
6+
7+
- The server is hosted on port **3000**.
8+
- A Next.js frontend automatically runs on port **3001**.
9+
- The server handles real-time connections, broadcasts messages, and manages disconnections.
10+
11+
## How to Run
12+
13+
1. **Clone the repository** and navigate to the project directory.
14+
15+
2. **Install dependencies**:
16+
17+
```bash
18+
npm install
19+
```
20+
21+
3. **Start the server**:
22+
23+
```bash
24+
npm run dev
25+
```
26+
27+
4. The server will start on port 3000, and the Next.js frontend will automatically run on port 3001.
28+
29+
## Server Details
30+
31+
- **Socket.io Configuration**:
32+
33+
- CORS is enabled for `http://localhost:3001`.
34+
- Accepts `GET` and `POST` methods.
35+
36+
- **Events**:
37+
- `connection`: Logs when a user connects.
38+
- `message`: Listens for messages from clients and broadcasts them to all connected users.
39+
- `disconnect`: Logs when a user disconnects.
40+
41+
## Demo
42+
43+
- Open your Next.js frontend on `http://localhost:3001`.
44+
- Send a message, and it will be broadcasted to all connected users.

0 commit comments

Comments
 (0)