title: NodeJS write or delete cookies on a specific route
body: <p>I have to do an app for the university ( and I'm not allowed to use express or other similar modules ) and I was wondering how do you specify the route on which you write a cookie. Why ?</p>
  
  <p>So far I've noticed that cookies are stored mainly on domains, but if u set a cookie on localhost:3000/ the cookie will be on the subroutes too, however if you set a cookie on localhost:3000/someroute, then that cookie won't be on "/" . </p>
  
  <blockquote>
    <p>So how do you set a cookie on "/" when you are on "/someRoute" and as
    well how can you delete a cookie ?</p>
  </blockquote>
  
  <p>This is how I've been writing on cookies so far</p>
  
  <pre><code>res.writeHead(302, { 'Set-Cookie': 'session='+sessionID });
  </code></pre>
  
  <blockquote>
    <ul>
    <li>Please Note that I ask how you edit those cookies on specific routes, and not how they work</li>
    </ul>
  </blockquote>