I'm trying to set up a simple server/client architecture using socket.io.
I have the following code in my main.js
var app = require('express')(); var http = require('http').createServer(app); var io = require('socket.io')(http); app.get('/', (req, res) => { res.send('<h1>Hello world</h1>'); }); io.on('connection', function(socket){ console.log('a user connected') }) http.listen(3001, () => { console.log('listening on *:3001'); }); I have the following code in my client.js
const io = require("socket.io-client"); let socket = io(':3001') I then run node main.js which prints "listening on *:3001", however when I run node client.js the expected "a user connected" is not printed. What am I missing in this simple architecture?