I'm new to nodejs, I've come across this function in express
var server = app.listen(()=>{
console.log(server.address())
})
How does the callback use the returned object from the listen function, can someone explain me the mechanism behind this code? Thanks
Perhaps it helps to rewrite the code into the following equivalent code:
var server;
function logServerAddress() {
console.log(server.address());
}
server = app.listen(logServerAddress);