Polka: Expose Polk().close function

Created on 10 Feb 2018  路  1Comment  路  Source: lukeed/polka

Native http has a close() function https://nodejs.org/api/http.html#http_server_close_callback which stops the server from accepting new connections. This is necessary for graceful shutdown of node server.

question

Most helpful comment

You have access to the underlying native server.

const app = polka();

// start it at some point
app.listen(PORT);
//~> this is calling 'app.server.listen' under the hood

// shut it down manually
app.server.close();

>All comments

You have access to the underlying native server.

const app = polka();

// start it at some point
app.listen(PORT);
//~> this is calling 'app.server.listen' under the hood

// shut it down manually
app.server.close();
Was this page helpful?
0 / 5 - 0 ratings

Related issues

kevinfiol picture kevinfiol  路  3Comments

itaditya picture itaditya  路  3Comments

lagmanzaza picture lagmanzaza  路  4Comments

dasantonym picture dasantonym  路  4Comments

ansarizafar picture ansarizafar  路  3Comments