Skip to content
This repository was archived by the owner on Nov 1, 2019. It is now read-only.

Commit efc6d0e

Browse files
committed
update: md (api)
1 parent e9c4373 commit efc6d0e

File tree

1 file changed

+39
-5
lines changed

1 file changed

+39
-5
lines changed

README.md

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ npm run build --report
2020

2121
## API
2222

23+
> /src/util/api.js
24+
2325
| name | API |
2426
| -------- | --------------- |
2527
| GET | getUrlData() |
@@ -40,15 +42,35 @@ const data = {
4042
}
4143
```
4244

45+
### Proxy
46+
47+
> /build/webpack.dev.conf.js -> devServer.proxy
48+
49+
```js
50+
module.exports = {
51+
//...
52+
devServer: {
53+
proxy: {
54+
'/api': 'http://localhost:3000'
55+
}
56+
}
57+
};
58+
```
59+
More: [Webpack dev-server #devserver-proxy ](https://webpack.js.org/configuration/dev-server/#devserver-proxy)
60+
4361
### GET
4462

4563
```js
4664
/**
4765
* GET api
48-
* @param {String} getfix url head
66+
* @param {String} suffix url address suffix
4967
* @param {Object} data parameters
5068
* @param function res:Object response; isErr:Boolean undefined/true
5169
*/
70+
api.getUrlData(suffix, data, callback);
71+
```
72+
73+
```js
5274
api.getUrlData("user/info", data, (res, isErr) => {
5375
console.log(res, isErr);
5476
});
@@ -59,10 +81,14 @@ api.getUrlData("user/info", data, (res, isErr) => {
5981
```js
6082
/**
6183
* GET api
62-
* @param {String} getfix url head
84+
* @param {String} suffix url address suffix
6385
* @param {Object} data parameters
6486
* @param function res:Object response; isErr:Boolean undefined/true
6587
*/
88+
api.deleteUrlData(suffix, data, callback);
89+
```
90+
91+
```js
6692
api.deleteUrlData("user/del", data, (res, isErr) => {
6793
console.log(res, isErr);
6894
});
@@ -73,13 +99,17 @@ api.deleteUrlData("user/del", data, (res, isErr) => {
7399
```js
74100
/**
75101
* GET api
76-
* @param {String} getfix url head
102+
* @param {String} suffix url address suffix
77103
* @param {Object} data parameters
78104
* @param function res:Object response; isErr:Boolean undefined/true
79105
* @param {Boolean} isJson form_data/json
80106
*/
107+
api.postUrlData(suffix, data, callback, isJson);
108+
```
109+
110+
```js
81111
api.postUrlData("user/login", data, (res, isErr) => {
82-
console.log(res, isErr);
112+
console.log(res, isErr);
83113
}, true);
84114
```
85115

@@ -88,11 +118,15 @@ api.postUrlData("user/login", data, (res, isErr) => {
88118
```js
89119
/**
90120
* GET api
91-
* @param {String} getfix url head
121+
* @param {String} suffix url address suffix
92122
* @param {Object} data parameters
93123
* @param function res:Object response; isErr:Boolean undefined/true
94124
* @param {Boolean} isJson form_data/json
95125
*/
126+
api.putUrlData(suffix, data, callback, isJson);
127+
```
128+
129+
```js
96130
api.putUrlData("user/info", data, (res, isErr) => {
97131
console.log(res, isErr);
98132
}, true);

0 commit comments

Comments
 (0)