-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
31 lines (27 loc) · 761 Bytes
/
server.js
File metadata and controls
31 lines (27 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import express from 'express';
import cors from 'cors';
import roomHandler from './api/room.js';
import healthHandler from './api/health.js';
const app = express();
app.use(cors());
app.use(express.json());
app.get('/api/health', async (req, res) => {
try {
await healthHandler(req, res);
} catch (error) {
console.error(error);
res.status(500).json({ ok: false, error: 'Local server error' });
}
});
app.all('/api/room', async (req, res) => {
try {
await roomHandler(req, res);
} catch (error) {
console.error(error);
res.status(500).json({ success: false, error: 'Local server error' });
}
});
const PORT = 3001;
app.listen(PORT, () => {
console.log(`Local Vercel API simulation server running on port ${PORT}`);
});