title: How to pass jwt token from one route to another
body: <p>I have two routes in my node js app: <code>users</code> &amp; <code>records</code></p>
  
  <p>In the <code>users</code> route I am getting the token on <code>/login</code> path:</p>
  
  <pre><code>users.post('/login', function(req, res) {
      const email = req.body.email;
      const password = req.body.password;
      var token = '';
      connection.query(`SELECT * FROM ${process.env.USER_TBL} WHERE EMAIL = ?`, [email], function(err, results, fields) {
          if (err) {
              res.status(200).json({'message' : err, 'token' : token})
          }
          if (results.length &gt; 0) {
              bcrypt.compare(password, results[0].PASSWORD).then(function(match) {
                  if (match == true) {
                      token = jwt.sign(JSON.parse(JSON.stringify(results[0])), process.env.SECRET_KEY, {
                          expiresIn: 5000
                      })
                      res.status(200).json({'message' : 'User verified', 'token' : token})
                  } else {
                      res.status(200).json({'message' : 'Email or Password does not match', 'token' : token})
                  }
              })
          } else {
              res.status(200).json({'message' : 'Email does not exists', 'token' : token})
          }
      })
      connection.end(err =&gt; {
          if(err) console.log(err);
      })
  })
  </code></pre>
  
  <p>In my second route <code>records</code> I am making a request to path <code>/addNewRecord</code>, </p>
  
  <pre><code>records.post('/addNewRecord', function(req, res) {
        //need the token to authenticate the request
  });
  </code></pre>
  
  <p>here I need the token generated from <code>/login</code> route to send in the hrader and authenticate my request.</p>
  
  <p>but I am understand how can I pass <code>token</code> value from <code>users</code> route to <code>records</code> route.</p>