Skip to content

Commit 07982a1

Browse files
committed
docs: Improve README formatting with consistent spacing
1 parent e3efea2 commit 07982a1

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

chat-app/README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,40 @@
33
### Backend Implementation (`backend/`)
44

55
#### `server.js` (New)
6+
67
- Set up Express server with CORS middleware
78
- Implemented **POST `/messages`** endpoint with input validation
89
- Validates sender name and message text
910
- Creates message objects with id, sender, text, likes, and dislikes
1011
- Returns 201 status on success, 400 on validation error
1112
- Triggers long polling callbacks to notify waiting clients
12-
1313
- Implemented **GET `/messages`** endpoint with long polling
1414
- Accepts `?since=` query parameter for incremental message loading
1515
- Returns only messages with id > sinceId
1616
- Holds client requests until new messages arrive (long polling)
1717
- Handles edge case where since=0 correctly
18-
1918
- Implemented **POST `/messages/:id/like`** endpoint
2019
- Increments like count for specified message
2120
- Notifies all waiting clients via long polling
2221
- Returns 200 on success, 404 if message not found
2322

2423
#### `package.json` (New)
24+
2525
- Configured as ES module project (`"type": "module"`)
2626
- Added Express 5.2.1 dependency
2727
- Added CORS 2.8.6 dependency
2828

2929
### Frontend Implementation (`frontend/`)
3030

3131
#### `index.html` (New)
32+
3233
- Semantic HTML structure with proper meta tags
3334
- Chat form with sender name and message inputs
3435
- Message container div for displaying chat history
3536
- Deferred JavaScript execution for proper DOM loading
3637

3738
#### `script.js` (New)
39+
3840
- **`getAllMessages()`** async function
3941
- Fetches messages from backend with `?since=` parameter
4042
- Implements incremental message loading via `lastIdSeen` tracking
@@ -56,6 +58,7 @@
5658
- Updates display instantly without waiting for server response
5759

5860
#### `styles.css` (New)
61+
5962
- Styled message containers with border, padding, and rounded corners
6063
- Light gray background (#f9f9f9) for message boxes
6164
- Styled like buttons with blue background (#007bff) and white text
@@ -64,6 +67,7 @@
6467
## Testing Instructions
6568

6669
### Setup
70+
6771
```bash
6872
# Install backend dependencies
6973
cd backend
@@ -72,3 +76,4 @@ npm install
7276
# Start backend server
7377
node server.js
7478

79+
```

0 commit comments

Comments
 (0)