createClient
Creates a new HTTP client instance with the given default configuration.
import { createClient } from '@parcely/core'
const http = createClient(defaults?: RequestConfig): Client
Parameters
| Parameter | Type | Description |
|---|---|---|
defaults | RequestConfig | Optional 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
Client-- the client interfaceRequestConfig-- all configuration options