Concorde documentation (crawl) · interactive version

Concorde reference — Endpoint. Endpoint<T, U> describes a single HTTP path (or a path accepted by API.get) and carries the expected response type T. Unlike DataProviderKey, there is no dot-navigation: the path is one string. Doc ID: docs/_misc/endpoint. Keywords: Concorde, supersoniks, docs/_misc/endpoint, endpoint, Endpoint, reference, API.get, (default , ${…}, {$…}, null, undefined, "", and , userId. URL: https://concorde.supersoniks.org/crawl/docs/_misc/endpoint.html.

Endpoint

Endpoint<T, U> describes a single HTTP path (or a path accepted by API.get) and carries the expected response type T. Unlike DataProviderKey, there is no dot-navigation: the path is one string.

The optional second generic U (default any) describes host properties used to resolve dynamic segments in the path (${…} / {$…}), for example with @get or @post. See Dynamic path placeholders for null / undefined / "" / 0 and skipEmptyPlaceholder.

Import

import { Endpoint } from "@supersoniks/concorde/utils/endpoint";

Construction

const users = new Endpoint&lt;User[]&gt;("users?limit=10");
users.path; // "users?limit=10"

const one = new Endpoint&lt;User, { userId: string }&gt;("users/${userId}");
// `userId` on the host class is observed when used with @get

Normalization

Endpoint.normalizePath trims the string, rejects an empty path, strips leading slashes for paths relative to serviceURL, collapses duplicate slashes, and validates absolute http(s):// URLs.

Publisher key for payloads

getDataProviderKey() returns a typed publisher key whose path matches the endpoint path (payload typing follows ApiResult for this endpoint). Useful when pairing @get with @publish / @subscribe (see @get).

Data-provider paths

Endpoint.looksLikeDataProviderPath(path) returns true for strings shaped like dataProvider(id)…, which API.get can resolve without HTTP.

See also