Skip to content

Commit ba06cdf

Browse files
committed
fix: fixed docs basic-usage.md (add two 'export default' on client side api handler example)
1 parent 10c5dd8 commit ba06cdf

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

docs/basic-usage.md

+14-18
Original file line numberDiff line numberDiff line change
@@ -96,24 +96,20 @@ Lets create our handler now (e.g we using axios to take care of this for us):
9696
// file: ~/api_handler
9797
import axios from 'axios';
9898

99-
export default () {
100-
101-
// path is the relative path of the route
102-
// verb is the method type
103-
// {query, body, params} are the given payload to send
104-
// {prefix} are api options (prefix is the api prefix, e.g: '/api')
105-
export default (path, verb, {query, body}, {prefix}) => {
106-
return axios({
107-
baseURL: `http://${process.env.HOST}:${process.env.PORT}${prefix || ''}`,
108-
timeout: 10000,
109-
url: path,
110-
method: verb.toLowerCase(),
111-
data: body,
112-
params: query
113-
}).then(({data}) => data);
114-
};
115-
116-
}
99+
// path is the relative path of the route
100+
// verb is the method type
101+
// {query, body, params} are the given payload to send
102+
// {prefix} are api options (prefix is the api prefix, e.g: '/api')
103+
export default (path, verb, {query, body}, {prefix}) => {
104+
return axios({
105+
baseURL: `http://${process.env.HOST}:${process.env.PORT}${prefix || ''}`,
106+
timeout: 10000,
107+
url: path,
108+
method: verb.toLowerCase(),
109+
data: body,
110+
params: query
111+
}).then(({data}) => data);
112+
};
117113
```
118114

119115
**NOTE**: You must return exactly what the controller action + ```successHandler``` return,

0 commit comments

Comments
 (0)