flexf

1.0.2 • Public • Published

FlexF

Axios flex fetch

Proof Of Concept: Project/Library in initial state.

Response Lookup

Axios response reference

  "data": {},
  "status": null
  "statusText": null,
  "headers": {},
  "config": {},
  "request": {}
const axios = require("axios").default;
const { flexF, responseLookup } = require("flexf");

const response = responseLookup(
  flexF(axios)({
    /* config */
  })
);
const result = response("data"); // response reference

Shorthand methods for Axios HTTP requests

Axios also provides a set of shorthand methods for performing different types of requests. The methods are as follows:

  • [x] request
  • [x] get
  • [x] delete
  • [x] head
  • [x] options
  • [x] post
  • [x] put
  • [x] patch

Request Config: requestConfig

Follow The Request Config documentation provided by axios.


Request example

const axios = require("axios").default;
const { flexF, responseLookup } = require("flexf");

const r = responseLookup(
  await flexF(axios)({
    method: "get",
    url: "https://jsonplaceholder.typicode.com/todos/",
    requestConfig: {
      params: {
        id: 1,
      },
      responseType: "json",
    },
  })
);

const result = r("data");

🤝 Contributing

  • Fork it!
  • Create your feature branch: git checkout -b my-new-feature
  • Commit your changes: git commit -am 'Add some feature'
  • Push to the branch: git push origin my-new-feature
  • Submit a pull request

👥 Credits


💢 Troubleshootings

This is just a personal project created for study / demonstration purpose and to simplify my working life, it may or may not be a good fit for your project(s).


❤️ Show your support

Please this repository if you like it or this project helped you!
Feel free to open issues or submit pull-requests to help me improving my work.


🤖 Author

Chris Michael

You can follow me on github · twitter


Copyright ©2021 flexF.

Package Sidebar

Install

npm i flexf

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

7.02 kB

Total Files

9

Last publish

Collaborators

  • chris5855