How to use session variable with NodeJs? : <p>I have the following NodeJS code:</p>

<pre><code>  let sql = `SELECT box_id, cubby_id, occupied, comport
           FROM box
           WHERE longestDimension = ?
           AND LOWER(box_id) = LOWER(?)`;

    connection.query(sql, [boxSelectedDimension, boxSelectedValue] , function(err, rows, fields) {
        if (!err) {
            for(var i=0; i&lt; rows.length; i++) {
                // Make the comparaison case insensitive
                if (rows[i].occupied == `unoccupied`) {
                    console.log("free");

                    var comport = rows[i].comport;
                    var command = "open" + rows[i].cubby_id;
</code></pre>

<p>Essentially i would like to store the value of the <code>comport</code> and <code>command</code> variable in a session variable so that the value of these variable could be used in another router page in nodejs. </p>

<p>I am not sure how to store and retrieve the session variable.</p>
