gw-http
v0.0.4
Published
gw-http
Downloads
1
Maintainers
Readme
gw-http
development
# 开发
npm run compile
git add .
git cz
# 测试
npm version prerelease
npm publish --tag test
npm i -S gw-http@test
# 发布
npm version patch
npm publish
usage
download
npm i -S gw-http
package
import Http from "gw-http";
Instance
const http = new Http({
url: "http://localhost:3000",
headrs: {},
errorControl: res => {
console.error("error", res);
return {
error: true,
errorMsg: 'error'
}
},
dataControl: res => {
return res;
}
});
post
http.post("/login", {
name: "test",
age: 18
}).then(res => {
console.log(res);
});
get
http.get("/getUser",{
name: "test",
age: 20
},
{
cache: true
}
).then(res => {
console.log(res);
});