ray-api
v1.0.0
Published
ray api, httpclient
Downloads
4
Readme
ray-api
author
ilex.h
useage
npm install ray-api
// web
import _Api from 'ray-api/lib/api';
// create instance
const Api = new _Api({
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json; charset=utf-8'
}
});
export default Api;
// 使用
Api.get(url, {params, data}).then(res => res);
Api.head(url, {params, data}).then(res => res);
Api.post(url, {params, data}).then(res => res);
Api.del(url, {params, data}).then(res => res);
Api.put(url, {params, data}).then(res => res);
Api.options(url, {params, data}).then(res => res);
Api.patch(url, {params, data}).then(res => res);
API
props
|name|type|default| description| |-----|---|--------|----| |opts | object | - | 请求参数 |
License
MIT