FuzzyRequests
FuzzyRequests is a simple fetch wrapper meant to provide some simple boilerplate, and mapping operations.
Usage:
const FR = //provide your base url within the constructorconst req = base:"https://jsonplaceholder.typicode.com" //perform a single get requestreq//perform multiple get requestsreq
All request types will always return a Promise.
Each request type accepts a single object argument with the following properties:
endpoint : "/your-api-end-point?queryParam=123" token: "your-unique-token-string" body: {Hello:"World"}
For instance, if your endpoint requires a token and a "user object", to post to "/users" you would make the following request
req
The endpoint will be appended to your base url, the token will be appended to "Authorization: Bearer" within the Headers object, and the body will be JSON.stringified.
The following requests/operations are available:
get / getMap post / postMap delete / deleteMap update / updateMap patch / patchMap