Coder Social home page Coder Social logo

net's Introduction

easily use http restful API

  方便快捷的使用http的GET/POST/PUT/DELETE
  安装方法: npm install net-helper -S
  // 使用demo
  const shttp = require('net-helper').shttp;
  shttp
    .post('http://www.baidu.com')
    //.attach({ file: 'c:/desktop/test.png' })//上传的文件
    .query({ name: 'xxx', password: 'yyy' })
    .send({ email: 'xxxx' })
    .end(function(err, res, headers){
      if(err) {
        console.log(err.message);
      } else {
        console.log(headers);
        console.log(res);
      }
    });

使用方法介绍:

  • get() get请求
  • post() post请求
  • patch() patch请求
  • put() put请求
  • delete() delete请求
  • header() 设置请求头(可以设置表单文件的提交方式)
  • attach() 上传文件
  • query() 设置search字符串
  • send() 设置请求的body数据(options.json一定为true!!!)
  • end() 发送请求,返回请求结果,同样接受回调函数参数
  • getHTML() 获取网页

net's People

Contributors

ruanjiayou avatar

Watchers

James Cloos avatar

net's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.