lasthourcloud/server/index.js
2022-05-11 16:15:34 +02:00

21 lines
430 B
JavaScript

import express from 'express';
import { createServer } from 'http';
import { Server } from 'socket.io';
import { handler } from '../build/handler.js';
const app = express();
const server = createServer(app);
const io = new Server(server);
io.on('connection', (socket) => {
socket.emit('eventFromServer', 'Hello, World 👋');
});
app.use(handler);
server.listen(port, () => {
console.log(`Listening on port ${port}`);
});