A wrapper around the native fetch API to simplify creating service objects for REST APIs. Version 0.2.1 is the latest stable release. This library is in maintenance mode with no recent updates. It provides a declarative way to define API endpoints, supports parameter interpolation, JSON handling for POST requests, and request interceptors. Unlike heavier HTTP clients, fetch-factory is lightweight and relies on native fetch and Promise, requiring polyfills for older environments. It is consumable in Node.js and browsers via bundlers.
npm install fetch-factoryNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of fetch-factory to create a REST client with find and create methods, including parameter substitution and JSON body for POST.
Install and import 'whatwg-fetch' and 'es6-promise' polyfills before using fetch-factory.
Use a request interceptor to modify headers or consider a different library for non-JSON payloads.
Always return an object with the three required properties, or clone the request and modify.
Ensure the fetch-factory script is loaded (dist/fetch-factory.js) or import the module correctly in your bundler.
Run `npm install fetch-factory` to install the package.
Install a fetch polyfill like 'whatwg-fetch' and import it before using fetch-factory.