Skip to content
module@warp-drive/utilities/json-api

Function setBuildURLConfig() ​

ts
function setBuildURLConfig(config: JSONAPIConfig): void;

Defined in: -private/json-api/-utils.ts:73

Allows setting extensions and profiles to be used in the Accept header.

Extensions and profiles are keyed by their namespace with the value being their URI.

The Basic Usage guide uses it to configure a host, a namespace and a pagination profile.

Example:

ts
setBuildURLConfig({
  extensions: {
    atomic: 'https://jsonapi.org/ext/atomic'
  },
  profiles: {
    pagination: 'https://jsonapi.org/profiles/ethanresnick/cursor-pagination'
  }
});

This also sets the global configuration for buildBaseURL for host and namespace values for the global coniguration done via import { setBuildURLConfig } from '@warp-drive/utilities';

These values may still be overridden by passing them to buildBaseURL directly.

This method may be called as many times as needed

ts
type BuildURLConfig = {
  host: string;
  namespace: string'
}

Parameters ​

config ​

JSONAPIConfig

Returns ​

void

Released under the MIT License.