I need to close server after getting callback from /auth/github/callback
url. With usual HTTP API closing
server is currently supporting with s
app.listen()
returns http.Server
. You should invoke close()
on that instance and not on app
instance.
Ex.
app.get(
'/auth/github/callback',
passport.authenticate('github', { failureRedirect: '/login' }),
function(req, res) {
res.redirect('/');
setTimeout(function () {
server.close();
// ^^^^^^^^^^^
}, 3000)
}
);
var server = app.listen('http://localhost:5000/');
You can inspect sources: /node_modules/express/lib/application.js