suchen

Heim  >  Fragen und Antworten  >  Hauptteil

node.js - nodejs https.get 方法访问国外网站

const https = require('https');

https.get('https://www.google.com/', (res) => {
    console.log('statusCode: ', res.statusCode);
    console.log('headers: ', res.headers);

    res.on('data', (d) => {
        process.stdout.write(d);
    });

}).on('error', (e) => {
    console.error(e);
});


要想解析国外网址怎么解,已有搭建好shadowsocks的digital ocean服务器

黄舟黄舟2781 Tage vor583

Antworte allen(1)Ich werde antworten

  • 迷茫

    迷茫2017-04-17 14:42:17

    npm config set proxy=http://shadowsocks IP:shadowsocks端口
    npm config set https_proxy=http://shadowsocks IP:shadowsocks端口

    Antwort
    0
  • StornierenAntwort