Express.js shutdown hook

前端 未结 4 587
旧巷少年郎
旧巷少年郎 2021-01-03 18:37

In Express.js, is there someway of setting a callback function to be executed when the application shuts down?

4条回答
  •  抹茶落季
    2021-01-03 18:56

    There is process.on('exit', callback):

    process.on('exit', function () {
      console.log('About to exit.');
    });
    

提交回复
热议问题