Spaces:
Sleeping
Sleeping
Update server.js
Browse files
server.js
CHANGED
|
@@ -14,15 +14,13 @@ const io = new Server(server, {
|
|
| 14 |
// Serve static files from /public
|
| 15 |
app.use(express.static(path.join(__dirname, 'public')));
|
| 16 |
|
| 17 |
-
//
|
| 18 |
-
app.get('/', (req, res) => res.sendFile(path.join(__dirname, 'public', '
|
| 19 |
-
app.get('/admin', (req, res) => res.sendFile(path.join(__dirname, 'public', 'admin.html')));
|
| 20 |
-
app.get('/client', (req, res) => res.sendFile(path.join(__dirname, 'public', 'client.html')));
|
| 21 |
|
| 22 |
const HOST = '0.0.0.0';
|
| 23 |
const PORT = process.env.PORT || 7860;
|
| 24 |
|
| 25 |
-
// Socket handling
|
| 26 |
io.on('connection', (socket) => {
|
| 27 |
const room = socket.handshake.query.room || 'default';
|
| 28 |
const role = socket.handshake.query.role || 'client';
|
|
|
|
| 14 |
// Serve static files from /public
|
| 15 |
app.use(express.static(path.join(__dirname, 'public')));
|
| 16 |
|
| 17 |
+
// Serve only the root route
|
| 18 |
+
app.get('/', (req, res) => res.sendFile(path.join(__dirname, 'public', 'index.html')));
|
|
|
|
|
|
|
| 19 |
|
| 20 |
const HOST = '0.0.0.0';
|
| 21 |
const PORT = process.env.PORT || 7860;
|
| 22 |
|
| 23 |
+
// Socket.io handling
|
| 24 |
io.on('connection', (socket) => {
|
| 25 |
const room = socket.handshake.query.room || 'default';
|
| 26 |
const role = socket.handshake.query.role || 'client';
|