Home > Software engineering >  What method in the Express.js library is used to close the server?
What method in the Express.js library is used to close the server?

Time:07-18

I've seen people try .close() but close doesn't seem to be a method in the Express library.

CodePudding user response:

Express' .listen() method return an http.Server instance that can be closed:

const express = require('express');
const app     = express();
const server  = app.listen(…);

…

server.close();
  • Related