1. 导入http-client模块
const hc = require("ykt-http-client");
2. 发送get请求
//不带参数
hc.get("localhost:8080/users/show").then(function(data){
//data为远程服务器返回的数据
});
//带请求参数
hc.get("localhost:8080/users/show",{phone:phone}).then(function(data){
//data为远程服务器返回的数据
});
3. 发送post请求
//不带参数
hc.post("localhost:8080/users/show").then(function(data){
//data为远程服务器返回的数据
});
//带请求参数
hc.post("localhost:8080/users/show",{phone:phone}).then(function(data){
//data为远程服务器返回的数据
});
-
Notifications
You must be signed in to change notification settings - Fork 0
zxy6173/ykt-http-client
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published