title: Redirect after Basic Http Auth Express.js
body: <p>I want to make a private access to an application using express.js like .htaccess and .htpasswd do in my php project.</p>
  
  <p>I'm using <a href="https://github.com/gevorg/http-auth" rel="nofollow">http-auth</a></p>
  
  <p>Here is my code :</p>
  
  <pre><code>app.get('/', function(req, res) {
    basic.apply(req, res, function(username) {
      res.redirect(routes.index);
    });
  });
  </code></pre>
  
  <p>The problem is I get an error :</p>
  
  <blockquote>
    <p>500 TypeError: Object function (req, res){ res.render('index', { title: 'Express' }); } has no method 'indexOf'</p>
  </blockquote>
  
  <p>Without authentication,</p>
  
  <pre><code>app.get('/', routes.index);
  </code></pre>
  
  <p>works without any troubles.</p>
  
  <p>I think about a middleware to read my index and then use res.send()... May it works?
  or what did I miss?</p>