init commit

This commit is contained in:
glazenbol
2026-03-18 05:49:16 +01:00
commit d89da60e2d
11 changed files with 322 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
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"]
}
});
// Socket.IO events
io.on("connection", (socket) => {
console.log("Client connected:", socket.id);
socket.on("paramUpdate", (data) => {
socket.broadcast.emit("paramUpdate", data);
});
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'));