title: How to implement "login remember me" using cookies in Express.js?
body: <p>I feel quite confused, do not understand what is the difference between res.cookie and req.cookies. And more strangely, I have found that if I do not set a cookie:</p>
  
  <pre><code>//The value will be:
  req.cookies.uid=="undefined"
  //instead of:
  req.cookies.uid==undefined
  </code></pre>
  
  <p>Why the express.js design the cookie like this?</p>
  
  <p>If I want to implement a "remember me" function while users trying to log in and set the cookie expire time to infinite or maybe a year, how should I use the cookie correctly?</p>
  
  <p>I have found that the cookieParser only support thing like this:</p>
  
  <pre><code>express.cookieParser("secret")
  </code></pre>
  
  <p>And does not support expire/maxAge setting.</p>