// https://github.com/request/request
const request = require('request')
console.time('get')
request.get('http://10.255.255.1', function(err) {
console.timeEnd('get')
});
平均在50ms左右 用curl命令 在 10以内
阿神2017-04-17 15:50:27
Don’t use the request library, try sending requests directly using the http library that comes with node.
var options = {
hostname: '10.255.255.1',
port: 80,
path: '/',
method: 'GET'
};
console.time('get');
var req = http.request(options, (res) => {
res.on('end', () => {
console.timeEnd('get');
});
});
request is an encapsulation of http