Just one of the things I'm learning. https://github.com/hchiam/learning
https://github.com/axios/axios has many more examples and API details.
Axios vs Apollo:
- Axios = REST API
- Apollo = GraphQL API
axios("/some-url?id=123"); // a GET request is used by default
axios.get("/some-url?id=123").then(function (response) {});
axios.get("/some-url", { params: { id: 123 } }).then(function (response) {});
axios({
  method: "post",
  url: "/user/123",
  data: {
    firstName: "Some",
    lastName: "Body",
  },
});
axios({
  method: "get",
  url: "http://bit.ly/2mTM3nY",
  responseType: "stream",
});Using yarn:
yarn add axiosOr with npm:
npm install axiosAlternatively:
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>Or:
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>Using yarn: (triple-click to select all)
git clone https://github.com/hchiam/learning-axios.git && cd learning-axios && yarn;
# and then
node index.jsOr with npm: (triple-click to select all)
git clone https://github.com/hchiam/learning-axios.git && cd learning-axios && npm install;
# and then
node index.jshttps://stackoverflow.com/a/52868182 or https://medium.com/@stubailo/how-to-call-a-graphql-server-with-axios-337a94ad6cf9