how to properly close node-express server?

前端 未结 4 1231
孤街浪徒
孤街浪徒 2020-12-08 01:35

I need to close server after getting callback from /auth/github/callback url. With usual HTTP API closing server is currently supporting with s

4条回答
  •  太阳男子
    2020-12-08 02:11

    In express v3 they removed this function.

    You can still achieve the same by assigning the result of app.listen() function and apply close on it:

    var server = app.listen(3000);
    server.close()
    

    https://github.com/visionmedia/express/issues/1366

提交回复
热议问题