美文网首页
nodejs获取请求数据

nodejs获取请求数据

作者: LaLaLaLaAAA | 来源:发表于2016-08-09 18:00 被阅读0次

varhttp=require("http");
varurlPath='http://127.0.0.1:8124/biz?'+
'name=freddon&domain='+encodeURIComponent("http://www.sagosoft.com/");
http.get(urlPath,function(response){
response.setEncoding('utf-8');
console.log("状态码%d\nheaders:\n%s\n当前的请求方式为【GET】请求",response.statusCode,
JSON.stringify(response.headers));
varreceiveData="";
response.on('data',function(chunk){
receiveData+=chunk;
}).on('end',function(){//打印
console.log("\n获得的数据为:"+receiveData);});
}).on('error',function(e){
console.log(e.message);});

相关文章

  • NodeJS获取GET和POST请求

    NodeJS获取GET请求 使用NodeJS获取GET请求,主要是通过使用NodeJS内置的querystring...

  • nodejs获取请求数据

    varhttp=require("http");varurlPath='http://127.0.0.1:8124...

  • 学习Node.js- 【1】搭建开发环境

    一、nodejs一个简单实例 二、nodejs处理get请求 get请求,通过querystring来传递数据,如...

  • nodejs:post请求在express里获取不到参数

    在nodejs写接口时 前端使用post请求 但是获取不到请求的参数,获取参数的方法如下:方法1:模块body-p...

  • 6.2KOA 数据请求 Request

    数据请求 Request 获取 Request 对象 获取 url 参数 获取 Get 请求参数 获取 POST ...

  • 15_Request

    Request 获取请求行数据 获取请求方式request.getMethod() 获取请求资源String re...

  • gf框架请求

    获取GET请求参数 Server: 执行请求: 获取POST请求参数 执行请求: 获取任意提交方式的请求数据 执行...

  • Servlet, Request, Response.

    Servlet Request 功能获取请求消息数据.获取请求行数据. eg. GET /website/d...

  • SpringBoot web获取请求数据

    SpringBoot web获取请求数据 一个网站最基本的功能就是匹配请求,获取请求数据,处理请求(业务处理),请...

  • Request功能

    Request功能: 获取请求消息数据获取请求行数据GET /day14/demo1?name=zhangsan ...

网友评论

      本文标题:nodejs获取请求数据

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