server.close()

The method that stops a Node.js server accepting new connections and calls back once every existing connection has ended.

In more detail

Kept-alive idle connections can keep it waiting, so recent Node.js versions close idle ones, and closeAllConnections() forces the rest. Pair it with a timeout during shutdown.

Related terms

Taught in

References