Skip to content

UseBuildUrl

katanakit-js / useBuildUrl

function useBuildUrl(
apiName,
endpointName,
options?
): string;

Defined in: core/services/http.service.ts:623

Returns the URL of a registered endpoint without calling fetch.

Parameter Type Description
apiName string Registered API key (from defineApiConfig).
endpointName string Endpoint key inside that API.
options? UrlOptions params fills :placeholders, query becomes the search string.

string

The fully built URL.

Unknown API, unknown endpoint, or a scheme that is not http(s).

import { useBuildUrl } from "katanakit-js";
useBuildUrl("pokeapi", "pokemonById", { params: { id: 25 } });
// → "https://pokeapi.co/api/v2/pokemon/25"