美文网首页
Node.js Request请求

Node.js Request请求

作者: pokeey | 来源:发表于2018-07-16 17:26 被阅读0次
"use strict";

const http = require('http');


var options = {
  protocol:'http:',
  hostname:'api.douban.com',
  port:'80',
  method:'GET',
  path:'/v2/movie/top250'
};

var request = http.request(options,(response) => {
  console.log(response.statusCode);
  // console.log('ok');
  console.log(response.headers);

});

request.on('error',(error) => {
  console.log(error);
});
request.end();

相关文章

网友评论

      本文标题:Node.js Request请求

      本文链接:https://www.haomeiwen.com/subject/wrwbpftx.html