Hi
For a few days now, I have been trying to figure out why my deploy does not work, without giving me more details. I try to deploy a server with Socket IO (code below).
I’m only listening on port 3000. I changed the host to “0.0.0.0” as a similar post indicated, still nothing. I am in free tier.
Would you have an idea?
import express from 'express';
import { createServer as createDevServer } from 'http';
import { Server } from 'socket.io';
import { env } from '../../configs/env.js';
import { handler } from './dist/handler.js';
function getServer() {
const app = express();
app.get('/healthcheck', (_, res) => res.end('ok'));
app.use(handler);
return createDevServer(app);
}
const server = getServer();
const io = new Server(server, {
cors: {
origin: ['http://localhost:3000', env.VITE_SOCKET_SERVER]
}
});
io.on('connection', socket => {
console.loog('Connection!')
});
server.listen(3000, '0.0.0.0', () => console.log('Listening on port 3000'));