# 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](/docs/misc/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](/docs/decorators/get) or [@post](/docs/decorators/post). See [Dynamic path placeholders](/docs/misc/dynamic-path) for `null` / `undefined` / `""` / `0` and `skipEmptyPlaceholder`.

## Import

<sonic-code language="typescript">
  <template>
import { Endpoint } from "@supersoniks/concorde/utils/endpoint";
  </template>
</sonic-code>

## Construction

<sonic-code language="typescript">
  <template>
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
  </template>
</sonic-code>

## 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](/docs/decorators/get)).

## Data-provider paths

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

## See also

- [API configuration](/docs/misc/api-configuration) — `serviceURL`, token, wording (mock demos)
- [@get](/docs/decorators/get) — GET decorator
- [@post](/docs/decorators/post) — POST decorator (body from a `DataProviderKey`)
- [@put](/docs/decorators/put) · [@patch](/docs/decorators/patch) — PUT / PATCH decorators
- [DataProviderKey](/docs/misc/dataProviderKey) — typed publisher paths (dot notation)
