What happens when you try to shut down an Express.js server while a user is connected to it?
var app = require('express')(); app.get('/', function( req, res ){ // respond after 10s setTimeout( function(){ res.send( 'all done!' ); }, 10000 ); }); app.listen( 5000 );
This is a simple express server that waits ten seconds before sending a response to a user.
Let’s find out what happens when I connect to it and shut the server down before it responds to me.