Skip to content

haul

Create a Haul instance

Signature

ts
function haul(
  baseURL: string,
  passedInstanceOptions: OptionsRaw = {},
  fetchPolyfill?: Window['fetch']
): HaulInstance

Parmeters

NameTypeDescription
baseURLstringThe base URL of the API
passedInstanceOptionsOptionsRawThe options to pass to the instance
fetchPolyfillWindow['fetch']The fetch polyfill to use

Returns

HaulInstance

Example

ts
const users = haul('/api/users')

users.get('2').then((user) => {
  // do something
})

Released under the MIT License.