Here you need to set a new header that will set the cookie header with the token=opensesame value.
// importing http module
http.createServer((request, response) => {
/* Setting the new header that contains cookies */
response.writeHead(200, {'Content-Type': 'text/html'});
response.end();
}).listen(8080);