You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 22 KiB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. # axios
  2. [![npm version](https://img.shields.io/npm/v/axios.svg?style=flat-square)](https://www.npmjs.org/package/axios)
  3. [![build status](https://img.shields.io/travis/axios/axios/master.svg?style=flat-square)](https://travis-ci.org/axios/axios)
  4. [![code coverage](https://img.shields.io/coveralls/mzabriskie/axios.svg?style=flat-square)](https://coveralls.io/r/mzabriskie/axios)
  5. [![install size](https://packagephobia.now.sh/badge?p=axios)](https://packagephobia.now.sh/result?p=axios)
  6. [![npm downloads](https://img.shields.io/npm/dm/axios.svg?style=flat-square)](http://npm-stat.com/charts.html?package=axios)
  7. [![gitter chat](https://img.shields.io/gitter/room/mzabriskie/axios.svg?style=flat-square)](https://gitter.im/mzabriskie/axios)
  8. [![code helpers](https://www.codetriage.com/axios/axios/badges/users.svg)](https://www.codetriage.com/axios/axios)
  9. Promise based HTTP client for the browser and node.js
  10. ## Features
  11. - Make [XMLHttpRequests](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) from the browser
  12. - Make [http](http://nodejs.org/api/http.html) requests from node.js
  13. - Supports the [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) API
  14. - Intercept request and response
  15. - Transform request and response data
  16. - Cancel requests
  17. - Automatic transforms for JSON data
  18. - Client side support for protecting against [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)
  19. ## Browser Support
  20. ![Chrome](https://raw.github.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/src/safari/safari_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/src/opera/opera_48x48.png) | ![Edge](https://raw.github.com/alrra/browser-logos/master/src/edge/edge_48x48.png) | ![IE](https://raw.github.com/alrra/browser-logos/master/src/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png) |
  21. --- | --- | --- | --- | --- | --- |
  22. Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |
  23. [![Browser Matrix](https://saucelabs.com/open_sauce/build_matrix/axios.svg)](https://saucelabs.com/u/axios)
  24. ## Installing
  25. Using npm:
  26. ```bash
  27. $ npm install axios
  28. ```
  29. Using bower:
  30. ```bash
  31. $ bower install axios
  32. ```
  33. Using yarn:
  34. ```bash
  35. $ yarn add axios
  36. ```
  37. Using cdn:
  38. ```html
  39. <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  40. ```
  41. ## Example
  42. ### note: CommonJS usage
  43. In order to gain the TypeScript typings (for intellisense / autocomplete) while using CommonJS imports with `require()` use the following approach:
  44. ```js
  45. const axios = require('axios').default;
  46. // axios.<method> will now provide autocomplete and parameter typings
  47. ```
  48. Performing a `GET` request
  49. ```js
  50. const axios = require('axios');
  51. // Make a request for a user with a given ID
  52. axios.get('/user?ID=12345')
  53. .then(function (response) {
  54. // handle success
  55. console.log(response);
  56. })
  57. .catch(function (error) {
  58. // handle error
  59. console.log(error);
  60. })
  61. .finally(function () {
  62. // always executed
  63. });
  64. // Optionally the request above could also be done as
  65. axios.get('/user', {
  66. params: {
  67. ID: 12345
  68. }
  69. })
  70. .then(function (response) {
  71. console.log(response);
  72. })
  73. .catch(function (error) {
  74. console.log(error);
  75. })
  76. .finally(function () {
  77. // always executed
  78. });
  79. // Want to use async/await? Add the `async` keyword to your outer function/method.
  80. async function getUser() {
  81. try {
  82. const response = await axios.get('/user?ID=12345');
  83. console.log(response);
  84. } catch (error) {
  85. console.error(error);
  86. }
  87. }
  88. ```
  89. > **NOTE:** `async/await` is part of ECMAScript 2017 and is not supported in Internet
  90. > Explorer and older browsers, so use with caution.
  91. Performing a `POST` request
  92. ```js
  93. axios.post('/user', {
  94. firstName: 'Fred',
  95. lastName: 'Flintstone'
  96. })
  97. .then(function (response) {
  98. console.log(response);
  99. })
  100. .catch(function (error) {
  101. console.log(error);
  102. });
  103. ```
  104. Performing multiple concurrent requests
  105. ```js
  106. function getUserAccount() {
  107. return axios.get('/user/12345');
  108. }
  109. function getUserPermissions() {
  110. return axios.get('/user/12345/permissions');
  111. }
  112. axios.all([getUserAccount(), getUserPermissions()])
  113. .then(axios.spread(function (acct, perms) {
  114. // Both requests are now complete
  115. }));
  116. ```
  117. ## axios API
  118. Requests can be made by passing the relevant config to `axios`.
  119. ##### axios(config)
  120. ```js
  121. // Send a POST request
  122. axios({
  123. method: 'post',
  124. url: '/user/12345',
  125. data: {
  126. firstName: 'Fred',
  127. lastName: 'Flintstone'
  128. }
  129. });
  130. ```
  131. ```js
  132. // GET request for remote image
  133. axios({
  134. method: 'get',
  135. url: 'http://bit.ly/2mTM3nY',
  136. responseType: 'stream'
  137. })
  138. .then(function (response) {
  139. response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'))
  140. });
  141. ```
  142. ##### axios(url[, config])
  143. ```js
  144. // Send a GET request (default method)
  145. axios('/user/12345');
  146. ```
  147. ### Request method aliases
  148. For convenience aliases have been provided for all supported request methods.
  149. ##### axios.request(config)
  150. ##### axios.get(url[, config])
  151. ##### axios.delete(url[, config])
  152. ##### axios.head(url[, config])
  153. ##### axios.options(url[, config])
  154. ##### axios.post(url[, data[, config]])
  155. ##### axios.put(url[, data[, config]])
  156. ##### axios.patch(url[, data[, config]])
  157. ###### NOTE
  158. When using the alias methods `url`, `method`, and `data` properties don't need to be specified in config.
  159. ### Concurrency
  160. Helper functions for dealing with concurrent requests.
  161. ##### axios.all(iterable)
  162. ##### axios.spread(callback)
  163. ### Creating an instance
  164. You can create a new instance of axios with a custom config.
  165. ##### axios.create([config])
  166. ```js
  167. const instance = axios.create({
  168. baseURL: 'https://some-domain.com/api/',
  169. timeout: 1000,
  170. headers: {'X-Custom-Header': 'foobar'}
  171. });
  172. ```
  173. ### Instance methods
  174. The available instance methods are listed below. The specified config will be merged with the instance config.
  175. ##### axios#request(config)
  176. ##### axios#get(url[, config])
  177. ##### axios#delete(url[, config])
  178. ##### axios#head(url[, config])
  179. ##### axios#options(url[, config])
  180. ##### axios#post(url[, data[, config]])
  181. ##### axios#put(url[, data[, config]])
  182. ##### axios#patch(url[, data[, config]])
  183. ##### axios#getUri([config])
  184. ## Request Config
  185. These are the available config options for making requests. Only the `url` is required. Requests will default to `GET` if `method` is not specified.
  186. ```js
  187. {
  188. // `url` is the server URL that will be used for the request
  189. url: '/user',
  190. // `method` is the request method to be used when making the request
  191. method: 'get', // default
  192. // `baseURL` will be prepended to `url` unless `url` is absolute.
  193. // It can be convenient to set `baseURL` for an instance of axios to pass relative URLs
  194. // to methods of that instance.
  195. baseURL: 'https://some-domain.com/api/',
  196. // `transformRequest` allows changes to the request data before it is sent to the server
  197. // This is only applicable for request methods 'PUT', 'POST', 'PATCH' and 'DELETE'
  198. // The last function in the array must return a string or an instance of Buffer, ArrayBuffer,
  199. // FormData or Stream
  200. // You may modify the headers object.
  201. transformRequest: [function (data, headers) {
  202. // Do whatever you want to transform the data
  203. return data;
  204. }],
  205. // `transformResponse` allows changes to the response data to be made before
  206. // it is passed to then/catch
  207. transformResponse: [function (data) {
  208. // Do whatever you want to transform the data
  209. return data;
  210. }],
  211. // `headers` are custom headers to be sent
  212. headers: {'X-Requested-With': 'XMLHttpRequest'},
  213. // `params` are the URL parameters to be sent with the request
  214. // Must be a plain object or a URLSearchParams object
  215. params: {
  216. ID: 12345
  217. },
  218. // `paramsSerializer` is an optional function in charge of serializing `params`
  219. // (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
  220. paramsSerializer: function (params) {
  221. return Qs.stringify(params, {arrayFormat: 'brackets'})
  222. },
  223. // `data` is the data to be sent as the request body
  224. // Only applicable for request methods 'PUT', 'POST', and 'PATCH'
  225. // When no `transformRequest` is set, must be of one of the following types:
  226. // - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams
  227. // - Browser only: FormData, File, Blob
  228. // - Node only: Stream, Buffer
  229. data: {
  230. firstName: 'Fred'
  231. },
  232. // syntax alternative to send data into the body
  233. // method post
  234. // only the value is sent, not the key
  235. data: 'Country=Brasil&City=Belo Horizonte',
  236. // `timeout` specifies the number of milliseconds before the request times out.
  237. // If the request takes longer than `timeout`, the request will be aborted.
  238. timeout: 1000, // default is `0` (no timeout)
  239. // `withCredentials` indicates whether or not cross-site Access-Control requests
  240. // should be made using credentials
  241. withCredentials: false, // default
  242. // `adapter` allows custom handling of requests which makes testing easier.
  243. // Return a promise and supply a valid response (see lib/adapters/README.md).
  244. adapter: function (config) {
  245. /* ... */
  246. },
  247. // `auth` indicates that HTTP Basic auth should be used, and supplies credentials.
  248. // This will set an `Authorization` header, overwriting any existing
  249. // `Authorization` custom headers you have set using `headers`.
  250. // Please note that only HTTP Basic auth is configurable through this parameter.
  251. // For Bearer tokens and such, use `Authorization` custom headers instead.
  252. auth: {
  253. username: 'janedoe',
  254. password: 's00pers3cret'
  255. },
  256. // `responseType` indicates the type of data that the server will respond with
  257. // options are: 'arraybuffer', 'document', 'json', 'text', 'stream'
  258. // browser only: 'blob'
  259. responseType: 'json', // default
  260. // `responseEncoding` indicates encoding to use for decoding responses
  261. // Note: Ignored for `responseType` of 'stream' or client-side requests
  262. responseEncoding: 'utf8', // default
  263. // `xsrfCookieName` is the name of the cookie to use as a value for xsrf token
  264. xsrfCookieName: 'XSRF-TOKEN', // default
  265. // `xsrfHeaderName` is the name of the http header that carries the xsrf token value
  266. xsrfHeaderName: 'X-XSRF-TOKEN', // default
  267. // `onUploadProgress` allows handling of progress events for uploads
  268. onUploadProgress: function (progressEvent) {
  269. // Do whatever you want with the native progress event
  270. },
  271. // `onDownloadProgress` allows handling of progress events for downloads
  272. onDownloadProgress: function (progressEvent) {
  273. // Do whatever you want with the native progress event
  274. },
  275. // `maxContentLength` defines the max size of the http response content in bytes allowed
  276. maxContentLength: 2000,
  277. // `validateStatus` defines whether to resolve or reject the promise for a given
  278. // HTTP response status code. If `validateStatus` returns `true` (or is set to `null`
  279. // or `undefined`), the promise will be resolved; otherwise, the promise will be
  280. // rejected.
  281. validateStatus: function (status) {
  282. return status >= 200 && status < 300; // default
  283. },
  284. // `maxRedirects` defines the maximum number of redirects to follow in node.js.
  285. // If set to 0, no redirects will be followed.
  286. maxRedirects: 5, // default
  287. // `socketPath` defines a UNIX Socket to be used in node.js.
  288. // e.g. '/var/run/docker.sock' to send requests to the docker daemon.
  289. // Only either `socketPath` or `proxy` can be specified.
  290. // If both are specified, `socketPath` is used.
  291. socketPath: null, // default
  292. // `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
  293. // and https requests, respectively, in node.js. This allows options to be added like
  294. // `keepAlive` that are not enabled by default.
  295. httpAgent: new http.Agent({ keepAlive: true }),
  296. httpsAgent: new https.Agent({ keepAlive: true }),
  297. // 'proxy' defines the hostname and port of the proxy server.
  298. // You can also define your proxy using the conventional `http_proxy` and
  299. // `https_proxy` environment variables. If you are using environment variables
  300. // for your proxy configuration, you can also define a `no_proxy` environment
  301. // variable as a comma-separated list of domains that should not be proxied.
  302. // Use `false` to disable proxies, ignoring environment variables.
  303. // `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and
  304. // supplies credentials.
  305. // This will set an `Proxy-Authorization` header, overwriting any existing
  306. // `Proxy-Authorization` custom headers you have set using `headers`.
  307. proxy: {
  308. host: '127.0.0.1',
  309. port: 9000,
  310. auth: {
  311. username: 'mikeymike',
  312. password: 'rapunz3l'
  313. }
  314. },
  315. // `cancelToken` specifies a cancel token that can be used to cancel the request
  316. // (see Cancellation section below for details)
  317. cancelToken: new CancelToken(function (cancel) {
  318. })
  319. }
  320. ```
  321. ## Response Schema
  322. The response for a request contains the following information.
  323. ```js
  324. {
  325. // `data` is the response that was provided by the server
  326. data: {},
  327. // `status` is the HTTP status code from the server response
  328. status: 200,
  329. // `statusText` is the HTTP status message from the server response
  330. statusText: 'OK',
  331. // `headers` the headers that the server responded with
  332. // All header names are lower cased
  333. headers: {},
  334. // `config` is the config that was provided to `axios` for the request
  335. config: {},
  336. // `request` is the request that generated this response
  337. // It is the last ClientRequest instance in node.js (in redirects)
  338. // and an XMLHttpRequest instance in the browser
  339. request: {}
  340. }
  341. ```
  342. When using `then`, you will receive the response as follows:
  343. ```js
  344. axios.get('/user/12345')
  345. .then(function (response) {
  346. console.log(response.data);
  347. console.log(response.status);
  348. console.log(response.statusText);
  349. console.log(response.headers);
  350. console.log(response.config);
  351. });
  352. ```
  353. When using `catch`, or passing a [rejection callback](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then) as second parameter of `then`, the response will be available through the `error` object as explained in the [Handling Errors](#handling-errors) section.
  354. ## Config Defaults
  355. You can specify config defaults that will be applied to every request.
  356. ### Global axios defaults
  357. ```js
  358. axios.defaults.baseURL = 'https://api.example.com';
  359. axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
  360. axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
  361. ```
  362. ### Custom instance defaults
  363. ```js
  364. // Set config defaults when creating the instance
  365. const instance = axios.create({
  366. baseURL: 'https://api.example.com'
  367. });
  368. // Alter defaults after instance has been created
  369. instance.defaults.headers.common['Authorization'] = AUTH_TOKEN;
  370. ```
  371. ### Config order of precedence
  372. Config will be merged with an order of precedence. The order is library defaults found in [lib/defaults.js](https://github.com/axios/axios/blob/master/lib/defaults.js#L28), then `defaults` property of the instance, and finally `config` argument for the request. The latter will take precedence over the former. Here's an example.
  373. ```js
  374. // Create an instance using the config defaults provided by the library
  375. // At this point the timeout config value is `0` as is the default for the library
  376. const instance = axios.create();
  377. // Override timeout default for the library
  378. // Now all requests using this instance will wait 2.5 seconds before timing out
  379. instance.defaults.timeout = 2500;
  380. // Override timeout for this request as it's known to take a long time
  381. instance.get('/longRequest', {
  382. timeout: 5000
  383. });
  384. ```
  385. ## Interceptors
  386. You can intercept requests or responses before they are handled by `then` or `catch`.
  387. ```js
  388. // Add a request interceptor
  389. axios.interceptors.request.use(function (config) {
  390. // Do something before request is sent
  391. return config;
  392. }, function (error) {
  393. // Do something with request error
  394. return Promise.reject(error);
  395. });
  396. // Add a response interceptor
  397. axios.interceptors.response.use(function (response) {
  398. // Any status code that lie within the range of 2xx cause this function to trigger
  399. // Do something with response data
  400. return response;
  401. }, function (error) {
  402. // Any status codes that falls outside the range of 2xx cause this function to trigger
  403. // Do something with response error
  404. return Promise.reject(error);
  405. });
  406. ```
  407. If you need to remove an interceptor later you can.
  408. ```js
  409. const myInterceptor = axios.interceptors.request.use(function () {/*...*/});
  410. axios.interceptors.request.eject(myInterceptor);
  411. ```
  412. You can add interceptors to a custom instance of axios.
  413. ```js
  414. const instance = axios.create();
  415. instance.interceptors.request.use(function () {/*...*/});
  416. ```
  417. ## Handling Errors
  418. ```js
  419. axios.get('/user/12345')
  420. .catch(function (error) {
  421. if (error.response) {
  422. // The request was made and the server responded with a status code
  423. // that falls out of the range of 2xx
  424. console.log(error.response.data);
  425. console.log(error.response.status);
  426. console.log(error.response.headers);
  427. } else if (error.request) {
  428. // The request was made but no response was received
  429. // `error.request` is an instance of XMLHttpRequest in the browser and an instance of
  430. // http.ClientRequest in node.js
  431. console.log(error.request);
  432. } else {
  433. // Something happened in setting up the request that triggered an Error
  434. console.log('Error', error.message);
  435. }
  436. console.log(error.config);
  437. });
  438. ```
  439. Using the `validateStatus` config option, you can define HTTP code(s) that should throw an error.
  440. ```js
  441. axios.get('/user/12345', {
  442. validateStatus: function (status) {
  443. return status < 500; // Reject only if the status code is greater than or equal to 500
  444. }
  445. })
  446. ```
  447. Using `toJSON` you get an object with more information about the HTTP error.
  448. ```js
  449. axios.get('/user/12345')
  450. .catch(function (error) {
  451. console.log(error.toJSON());
  452. });
  453. ```
  454. ## Cancellation
  455. You can cancel a request using a *cancel token*.
  456. > The axios cancel token API is based on the withdrawn [cancelable promises proposal](https://github.com/tc39/proposal-cancelable-promises).
  457. You can create a cancel token using the `CancelToken.source` factory as shown below:
  458. ```js
  459. const CancelToken = axios.CancelToken;
  460. const source = CancelToken.source();
  461. axios.get('/user/12345', {
  462. cancelToken: source.token
  463. }).catch(function (thrown) {
  464. if (axios.isCancel(thrown)) {
  465. console.log('Request canceled', thrown.message);
  466. } else {
  467. // handle error
  468. }
  469. });
  470. axios.post('/user/12345', {
  471. name: 'new name'
  472. }, {
  473. cancelToken: source.token
  474. })
  475. // cancel the request (the message parameter is optional)
  476. source.cancel('Operation canceled by the user.');
  477. ```
  478. You can also create a cancel token by passing an executor function to the `CancelToken` constructor:
  479. ```js
  480. const CancelToken = axios.CancelToken;
  481. let cancel;
  482. axios.get('/user/12345', {
  483. cancelToken: new CancelToken(function executor(c) {
  484. // An executor function receives a cancel function as a parameter
  485. cancel = c;
  486. })
  487. });
  488. // cancel the request
  489. cancel();
  490. ```
  491. > Note: you can cancel several requests with the same cancel token.
  492. ## Using application/x-www-form-urlencoded format
  493. By default, axios serializes JavaScript objects to `JSON`. To send data in the `application/x-www-form-urlencoded` format instead, you can use one of the following options.
  494. ### Browser
  495. In a browser, you can use the [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) API as follows:
  496. ```js
  497. const params = new URLSearchParams();
  498. params.append('param1', 'value1');
  499. params.append('param2', 'value2');
  500. axios.post('/foo', params);
  501. ```
  502. > Note that `URLSearchParams` is not supported by all browsers (see [caniuse.com](http://www.caniuse.com/#feat=urlsearchparams)), but there is a [polyfill](https://github.com/WebReflection/url-search-params) available (make sure to polyfill the global environment).
  503. Alternatively, you can encode data using the [`qs`](https://github.com/ljharb/qs) library:
  504. ```js
  505. const qs = require('qs');
  506. axios.post('/foo', qs.stringify({ 'bar': 123 }));
  507. ```
  508. Or in another way (ES6),
  509. ```js
  510. import qs from 'qs';
  511. const data = { 'bar': 123 };
  512. const options = {
  513. method: 'POST',
  514. headers: { 'content-type': 'application/x-www-form-urlencoded' },
  515. data: qs.stringify(data),
  516. url,
  517. };
  518. axios(options);
  519. ```
  520. ### Node.js
  521. In node.js, you can use the [`querystring`](https://nodejs.org/api/querystring.html) module as follows:
  522. ```js
  523. const querystring = require('querystring');
  524. axios.post('http://something.com/', querystring.stringify({ foo: 'bar' }));
  525. ```
  526. You can also use the [`qs`](https://github.com/ljharb/qs) library.
  527. ###### NOTE
  528. The `qs` library is preferable if you need to stringify nested objects, as the `querystring` method has known issues with that use case (https://github.com/nodejs/node-v0.x-archive/issues/1665).
  529. ## Semver
  530. Until axios reaches a `1.0` release, breaking changes will be released with a new minor version. For example `0.5.1`, and `0.5.4` will have the same API, but `0.6.0` will have breaking changes.
  531. ## Promises
  532. axios depends on a native ES6 Promise implementation to be [supported](http://caniuse.com/promises).
  533. If your environment doesn't support ES6 Promises, you can [polyfill](https://github.com/jakearchibald/es6-promise).
  534. ## TypeScript
  535. axios includes [TypeScript](http://typescriptlang.org) definitions.
  536. ```typescript
  537. import axios from 'axios';
  538. axios.get('/user?ID=12345');
  539. ```
  540. ## Resources
  541. * [Changelog](https://github.com/axios/axios/blob/master/CHANGELOG.md)
  542. * [Upgrade Guide](https://github.com/axios/axios/blob/master/UPGRADE_GUIDE.md)
  543. * [Ecosystem](https://github.com/axios/axios/blob/master/ECOSYSTEM.md)
  544. * [Contributing Guide](https://github.com/axios/axios/blob/master/CONTRIBUTING.md)
  545. * [Code of Conduct](https://github.com/axios/axios/blob/master/CODE_OF_CONDUCT.md)
  546. ## Credits
  547. axios is heavily inspired by the [$http service](https://docs.angularjs.org/api/ng/service/$http) provided in [Angular](https://angularjs.org/). Ultimately axios is an effort to provide a standalone `$http`-like service for use outside of Angular.
  548. ## License
  549. [MIT](LICENSE)