title: Is it possible to pass a request header on a link with EJS template? Express/Node.js
body: <p>I'm a trying to make a route accessible only if you are authenticated with JWT using below middleware but I can't seem to find a way to pass the token in the get request from client side ?
  It works fine on postman and I if using a fetch from client side it won't redirect me to the page I want to go</p>
  <p>auth.js</p>
  <pre><code>async function (req, res, next) {
    const token = req.header('x-auth-token');
  
    if (!token) {
      return res.status(401).json({ msg: 'Forbidden' });
    }
  
    try {
      const decoded = jwt.verify(token, process.env.TOKEN_SECRET);
  
      req.user = decoded.user;
  
      next();
    } catch (e) {
      return res.status(401).json({ err: 'fail' });
    }
  };
  </code></pre>
  <p>server side</p>
  <pre><code>router.get('/', auth, function (req, res, next) {
    res.render('pages/person');
  });
  </code></pre>