Skip to content

Commit 4a964da

Browse files
committed
feat: enhance server CORS configuration and improve chat message display styling
1 parent 1461fe7 commit 4a964da

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

chat-app/backend/server.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
const express = require('express');
2-
const path = require('path');
32
const cors = require('cors');
43

54
const app = express();
65
const PORT = process.env.PORT || 3000;
6+
const FRONTEND_ORIGIN = process.env.FRONTEND_ORIGIN;
77

8-
app.use(cors());
8+
if (FRONTEND_ORIGIN) {
9+
app.use(cors({ origin: FRONTEND_ORIGIN }));
10+
} else {
11+
app.use(cors());
12+
}
913
app.use(express.json());
10-
app.use(express.static(path.join(__dirname, '../frontend')));
1114

1215
const messages = [
1316
{

chat-app/frontend/style.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ button.secondary:hover {
146146
margin: 16px 0 0;
147147
display: grid;
148148
gap: 12px;
149+
max-height: 50vh;
150+
overflow-y: auto;
149151
}
150152

151153
.message {

0 commit comments

Comments
 (0)