Monday 13 March 2017

node server http close event fires always

I am trying to create a close event that fires before the server shuts down.

for this ive created the following:

var express = require('express');
var app = express();
var http = require('http').Server(app);
var listenTo = require('./config/port.json')["port"];


http.listen(listenTo, function () {
    console.log('listening on *:' + listenTo);
});

http.close(function (event) {
    console.log('closed');
});

However this just shuts down the server.

So my question is how can i listen on server shut down using http



via Marc Rasmussen

No comments:

Post a Comment