Fetch wrapper that prepends a default base URL to all fetch calls. Version 1.0.0, released as a stable package. It works with both browser's native fetch and node-fetch. Simplifies testing and server-side code by avoiding repetitive URL prefixes. Unlike node-fetch or isomorphic-fetch, it adds a base URL layer without modifying the underlying fetch implementation.
npm install fetch-absoluteNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create an absolute-fetch wrapper using node-fetch and make a request.
Ensure all request paths start with '/' to have the base URL prepended.
Manually ensure base URL ends with '/' if needed, or request path starts correctly.
Ensure you pass a valid fetch function: const fetchAbsolute = require('fetch-absolute'); const fetch = require('node-fetch'); const fetchApi = fetchAbsolute(fetch)('http://localhost:3030');Prefix your request path with '/': fetchApi('/api/endpoint')No dependency data recorded yet.