# 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.md/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 the [@get](#docs/_decorators/get.md/get) decorator.

## 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 `ApiGetResult` for this endpoint). Useful when pairing `@get` with `@publish` / `@subscribe` (see [@get](#docs/_decorators/get.md/get)).

## Data-provider paths

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

## See also

- [@get](#docs/_decorators/get.md/get) — decorator that uses `Endpoint<T>`
- [DataProviderKey](#docs/_misc/dataProviderKey.md/dataProviderKey) — typed publisher paths (dot notation)
