add example with request module

This commit is contained in:
AJ ONeal 2016-06-27 18:28:00 -06:00
parent 13d73b89c0
commit 9bab728f8b
1 changed files with 21 additions and 0 deletions

21
request-with-request.js Normal file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env node
'use strict';
var fs = require('fs');
var path = require('path');
var request = require('request');
var ca = fs.readFileSync(path.join(__dirname, 'certs', 'client', 'chain.pem'));
var port = process.argv[2] || 8043;
var hostname = process.argv[3] || 'localhost.daplie.com';
var options = {
url: 'https://' + hostname + ':' + port
, agentOptions: {
ca: ca
}
};
request.get(options, function (err, resp) {
console.log(resp.body);
});