Why are my cookies not being set Node.JS and cookie-parser?
<p>So I've been working on this project with Node.JS recently and am trying to set a cookie based of an id passed as a get variable - the code was working yesterday however today I can console log the query.id fine yet my cookie is undefined and I can't figure out why - anyone dealt with something like this before and can shed some light?</p>

<pre><code>app.get('/home', function(req, res) {
console.log(req.query.id);
if (res.query != undefined &amp;&amp; res.query.id != undefined) {
    res.cookie('user_id', req.query.id);  
    res.send(req.cookies.user_id);
};
console.log(req.cookies.user_id);
var user_id = req.cookies.user_id;
console.log(user_id);
var project = [];
retrieve_projects = connection.query('SELECT * FROM projects,    project_users WHERE project_users.user_id = '+user_id+' AND   project_users.project_id = projects.id' , user_id, function (err, result){
    //console.log(result);
    //throw err;
    for (var i = 0; i &lt;= result.length; i++) {
        if (result[i] != undefined) {
            //console.log(result[i]);
            var tempProject ={
                project_id: result[i].id,
                project_title: result[i].title,
                description: result[i].description,
                start_date: result[i].start_date,
                end_date: result[i].end_date,
                status: result[i].status,
                project_colour: result[i].project_colour
            }    
            project.push(tempProject);
        }
    }
    //console.log(project);
    res.render('home',
    {    
        title: 'Utasko | Home',
        project_data:project
    });
});    
});
</code></pre>