title: how to properly close node-express server?
body: <p>I need to close server after getting callback from <code>/auth/github/callback</code>
  url. With usual <strong><a href="http://nodejs.org/docs/latest/api/http.html" rel="noreferrer">HTTP API</a></strong> closing
  server is currently supporting with <a href="http://nodejs.org/docs/latest/api/http.html" rel="noreferrer"><code>server.close([callback])</code></a>
  API function, but with node-express server i’m getting <code>TypeError: Object function app(req, res){ app.handle(req, res); } has no method 'close'</code>
  error. And I don't know how to find information to solve this problem.<br>
  <strong>How should I close express server?</strong></p>
  
  <p>NodeJS configuration notes:</p>
  
  <pre><code>$ node --version
  v0.8.17
  $ npm --version
  1.2.0
  $ npm view express version
  3.0.6
  </code></pre>
  
  <p>Actual application code:</p>
  
  <pre><code>var app = express();
  
  // configure Express
  app.configure(function() {
      // … configuration
  });
  
  app.get(
      '/auth/github/callback',
      passport.authenticate('github', { failureRedirect: '/login' }),
      function(req, res) {
          res.redirect('/');
  
          setTimeout(function () {
              app.close();
              // TypeError: Object function app(req, res){ app.handle(req, res); } has no method 'close'
          }, 3000)
      }
  );
  
  app.listen('http://localhost:5000/');
  </code></pre>
  
  <p>Also, I have found <a href="https://stackoverflow.com/questions/13293257/nodejs-express-close-server-when-request-is-done?rq=1">‘nodejs express close…’</a> but I don't sure if I can use it with code I have: <code>var app = express();</code>.</p>