I'd like to output a message like "Listening on port {port_#}" to the terminal from my node js server.
I found documentation, such as this, NodeJS: How to get the server's port?, but they only talk about Express JS.
I'm using the ConnectJS aspect to connect. So my code looks like:
var connect = require('connect');
var serveStatic = require('serve-static');
connect().use(serveStatic(__dirname)).listen(8080);
console.log("Listening on port %d", connect.address().port);
This, however, does not work. How would I log the port to terminal?