You often see example hello world code for Node that creates an Http Server, starts listening on a port, then followed by something along the lines of:
conso
If you're using express, you can get it from the request object:
req.app.settings.port // => 8080 or whatever your app is listening at.