title: Saving into localStorage with nodejs
body: <p>I need to save jwt-token in local-storage through nodejs after the user has logged in (has been authorized ).</p>
  
  <p>After I check if the user/password is correct in my controller - I save generated token in local storage. As it stands I can't reference window as it doesn't exists.</p>
  
  <pre><code>ReferenceError: window is not defined 
  </code></pre>
  
  <p>This is how I'm currently trying to do it.</p>
  
  <pre><code>...
        payload = {
          sub: user.email,
          role: user.role
        };
  
        token = jwt.sign(payload, jwtSecretKey, {expiresIn: '60m'});
  
        window.localStorage.setItem('token', token);
  
        res.status(200).render('index' , {
          user: user,
          token: token
        });
  ...
  </code></pre>