Gofor is a lean, isomorphic fetch decorator that deep reverse merges default options, allowing per-request overrides. Current stable version is 3.0.6. It supports Node.js >=8.9.0 and browsers, using the native fetch API or a polyfill. Compared to similar libraries like ky or wretch, Gofor focuses on simplicity and minimal configuration, providing a single class with a config method for setting defaults (including headers as objects or Headers instances) and a pre-configured fetch instance. It has no runtime dependencies and ships as CommonJS only.
npm install goforNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Instantiate a Gofor with default auth header, perform a fetch, and show pre-configured instance usage with config method.
Replace require('gofor/server') with require('gofor') or the ESM equivalent.Update any imports referencing 'gofor/dist/...' to use the main entry point directly.
Install node-fetch (v2 for CommonJS, v3 for ESM) and set globalThis.fetch = require('node-fetch') or use an import.Assign the import to a constant if you need a single shared instance across modules.
Prefer instantiation with new Gofor({...}) over the legacy gofor.config() pattern if you need multiple configs.Use import { gofor } from 'gofor' and then call gofor(url) or gofor.fetch(url).Change import to 'gofor' directly.
Use import from 'gofor' instead.
Install and set up a fetch polyfill like 'node-fetch' before using Gofor.
Use import { gofor } from 'gofor' for the pre-configured instance, or import Gofor and create a new instance.