1.0.2 • Published 3 years ago

flexf v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

⚡ 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:

  • request
  • get
  • delete
  • head
  • options
  • post
  • put
  • 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");

:handshake: 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

:busts_in_silhouette: Credits


:anger: 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).


:heart: Show your support

Please :star: 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.


:robot: Author

Chris Michael

You can follow me on github · twitter


Copyright ©2021 flexF.