// 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以内
欢迎选择我的课程,让我们一起见证您的进步~~
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
Don’t use the request library, try sending requests directly using the http library that comes with node.
request is an encapsulation of http