Initial Commit

This commit is contained in:
2025-12-14 21:00:46 +01:00
commit d687c6b77f
31 changed files with 6478 additions and 0 deletions

34
src/server/index.ts Normal file
View File

@@ -0,0 +1,34 @@
import express, { Request, Response } from 'express';
import { createServer } from 'http';
import { Server } from 'socket.io';
const app = express();
const httpServer = createServer(app);
const io = new Server(httpServer, {
cors: {
origin: "*", // Adjust for production
methods: ["GET", "POST"]
}
});
const PORT = process.env.PORT || 3000;
app.use(express.json());
// API Routes
app.get('/api/health', (_req: Request, res: Response) => {
res.json({ status: 'ok', message: 'Server is running' });
});
// Socket.IO connection
io.on('connection', (socket) => {
console.log('A user connected', socket.id);
socket.on('disconnect', () => {
console.log('User disconnected', socket.id);
});
});
httpServer.listen(PORT, () => {
console.log(`Server running on http://localhost:${PORT}`);
});