title: Set a header in middleware node.js express framework
body: <p>I have a middleware doing some auth. In this auth-method I need to set a response header.</p>
  
  <pre><code>server.get('/api/users, auth(), getUsers);
  </code></pre>
  
  <p>My authmethod:</p>
  
  <pre><code>module.exports = (isProduction) =&gt; {
    return function(req, res, next){
       ...
  
       next();
  
    }
  }
  </code></pre>
  
  <p>How do I attach a header in this auth function?</p>