server.listen()

The method that starts a Node.js server accepting connections on a port; it emits listening once it is ready.

In more detail

server.address().port then tells you which port was actually chosen, which matters when you asked for port 0. The callback or listening event is the signal that the server can accept requests.

Related terms

Taught in

References