I would like to use http.Server.connections in my express 3 route?
Is there no way to get it anymore?
Should I just
app.set(‘server’, server);
express.createServer() is deprecated and express applications no longer inherit from http.Server
var app = express(),
server = http.createServer(app);
server.listen(8080);
...
module.exports = function (app) {
app.get('/connections', function (req, res) {
res.send({
connections: app.connections
// app != http.Server in express 3
});
});
};
Instead of
app.connectionsyou need to sendserver.connections, since you’ve used:server = http.createServer(app);So your code becomes: