## axios 實例方法
* axios#request(config)
* axios#get(url[, config])
* axios#delete(url[, config])
* axios#head(url[, config])
* axios#options(url[, config])
* axios#post(url[, data[, config]])
* axios#put(url[, data[, config]])
* axios#patch(url[, data[, config]])
## 使用示例
axios 實例方法的返回值都是 Promise,所以比較典型的使用方法如下:
get 請求:
```js
axios.get('http://localhost:9001/api/users', {
params: {
// 放在 URL 中的請求參數
id: 101
}
}).then((response) => {
// 請求成功的處理
}).catch((response) => {
// 請求失敗的處理
})
```
post 請求:
```js
axios.post('http://localhost:9001/api/login', {
// 放在 body 中的請求參數
username: 'yungsem',
password: '123456'
}).then((response) => {
// 請求成功的處理
}).catch((response) => {
// 請求失敗的處理
})
```
## response 結構
response 結構如下:
```js
{
// `data` is the response that was provided by the server
data: {},
// `status` is the HTTP status code from the server response
status: 200,
// `statusText` is the HTTP status message from the server response
statusText: 'OK',
// `headers` the headers that the server responded with
// All header names are lower cased
headers: {},
// `config` is the config that was provided to `axios` for the request
config: {},
// `request` is the request that generated this response
// It is the last ClientRequest instance in node.js (in redirects)
// and an XMLHttpRequest instance the browser
request: {}
}
```