final commit

This commit is contained in:
glazenbol
2026-06-28 12:44:07 +02:00
parent ff58292273
commit 7b61244940
3 changed files with 23 additions and 12 deletions
+11 -8
View File
@@ -1,15 +1,14 @@
import express from 'express';
import http from 'http';
import { Server } from 'socket.io';
import express from "express";
import http from "http";
import { Server } from "socket.io";
const app = express();
const server = http.createServer(app);
const io = new Server(server, {
cors: {
origin: "http://localhost:5173", // allow Vite frontend
methods: ["GET", "POST"]
}
methods: ["GET", "POST"],
},
});
// Socket.IO events
@@ -20,10 +19,14 @@ io.on("connection", (socket) => {
socket.broadcast.emit("paramUpdate", data);
});
socket.on("pulse", () => {
socket.broadcast.emit("pulse");
});
socket.on("disconnect", () => {
console.log("Client disconnected:", socket.id);
});
});
app.use(express.static('frontend/dist'));
server.listen(3000, () => console.log('Server running on http://localhost'));
app.use(express.static("frontend/dist"));
server.listen(3000, () => console.log("Server running on http://localhost"));