Skip to main content

createClient

Creates a new HTTP client instance with the given default configuration.

import { createClient } from '@parcely/core'

const http = createClient(defaults?: RequestConfig): Client

Parameters

ParameterTypeDescription
defaultsRequestConfigOptional default configuration applied to every request.

Returns

A Client instance.

Example

import { createClient } from '@parcely/core'

const http = createClient({
baseURL: 'https://api.example.com',
headers: { Accept: 'application/json' },
timeout: 5000,
})

See also