Q: Unhandled 'error' event in express.js var express = require('express');
var router = express.Router();

/* Socket.io */
var server = require("http").Server(express);  
var io = require("socket.io")(server);
server.listen(5000);
io.on('connection', function(client) {
  client.on('score_'+userId, function(data) {

  });
});

/* GET home page. */
router.get('/', function(req, res, next) {
  res.render('index', { title: 'Express' });
});

module.exports = router;

The socket.io block is causing th error, but I don't know why. The code look just fine to me.

A: usevar server = require("http").createServer(express());  instead of var server = require("http").Server(express);
