Node Express - redirect to login view
<p>I am trying to configure my express application to redirect to a login page based on some logic. I have the following:</p>

<pre><code>  app.use('/', function(req, res, next){
    if(!req.session.accessToken){
      //do something here
    }
    next();
  });
</code></pre>

<p>I have a login.html file located in the root of the directory my application is being served from, I am just unsure what I need to call on the <code>res</code> object e.g. <code>redirect</code>, <code>send</code></p>

<p>Also, I know the above will actually cause an infinite loop.</p>

<p>What's the correct approach here?</p>