Unable to set cookie in browser using request and express modules in NodeJS
<p>I am having a client and a server node written in express. The client communicates with server using request module, the server will send response back to the client. Here in server code I am sending cookie back to the client. But I am unable to see the cookies in the browser. In client req.cookies is giving {}</p>

<p>Server code:</p>

<pre><code>var express = require('express');
var cookieParser = require('cookie-parser');
var app = express();
app.use(cookieParser());
app.get('/test-cookie', function(req, res) {
    res.cookie('abc', 'xyz').send('Cookie is set');
});
app.listen(9000);
</code></pre>

<p>Client code:</p>

<pre><code>var express = require('express');
var request = require('request');
var cookieParser = require('cookie-parser');
var app = express();
app.use(cookieParser());
app.get('/', function(req, res) {
    request({
        url: 'http://localhost:9000/test-cookie',
        method: 'GET'
    }, function(error, response, body) {
        if (error) {
            res.send({
                msg: error
            });
        } else {
            if (200 == response.statusCode) {
                console.log(req.cookies);
            }
        }
    });
});
app.listen(7000);
</code></pre>