first commit
This commit is contained in:
commit
c7fa91c8ce
34 files changed
+4631
No files matched your search
@@ -0,0 +1,30 @@
|
||||
// Szerver belépési pont - HTTP szerver indítás és Socket.io csatolás
|
||||
import 'dotenv/config';
|
||||
import { createServer } from 'http';
|
||||
import { Server } from 'socket.io';
|
||||
import app from './app.js';
|
||||
import { initSocket } from './socket.js';
|
||||
|
||||
const PORT = process.env.PORT || 3000;
|
||||
|
||||
// HTTP szerver létrehozása az Express app köré
|
||||
const httpServer = createServer(app);
|
||||
|
||||
// Socket.io inicializálás
|
||||
const io = new Server(httpServer, {
|
||||
// Nginx proxy mögötti CORS - fejlesztési módban engedékenyebb
|
||||
cors: {
|
||||
origin: process.env.NODE_ENV === 'production' ? false : '*',
|
||||
methods: ['GET', 'POST']
|
||||
}
|
||||
});
|
||||
|
||||
// Socket logika beállítása
|
||||
initSocket(io);
|
||||
|
||||
// io elérhetővé tétele az Express app számára (route-okból kell)
|
||||
app.set('io', io);
|
||||
|
||||
httpServer.listen(PORT, () => {
|
||||
console.log(`Szerver fut: http://localhost:${PORT}`);
|
||||
});
|
||||
Reference in new issue
Block a user