Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Does express for node.js have a .request()

var http = require('http');

var options = {
    host: 'www.google.com',
    port: 80,
    path: '/upload',
    method: 'POST'
};

var req = http.request(options, function(res) {
    console.log('STATUS: ' + res.statusCode);
    console.log('HEADERS: ' + JSON.stringify(res.headers));
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
    console.log('BODY: ' + chunk);
    });
});

// write data to request body
req.write('data
');
req.write('data
');
req.end();
 
PREVIOUS NEXT
Tagged: #Does #express
ADD COMMENT
Topic
Name
7+2 =