PublicApiEndpoint
interfaz
Descriptor público de un endpoint de API. Omite a propósito el archivo del handler y los schemas del servidor, así que puede viajar al navegador.
ts
import type { PublicApiEndpoint } from "@meekojs/meeko/framework";Código fuente src/shared/clients.ts:13
Declaración #
ts
interface PublicApiEndpoint {
readonly clientKey: string
readonly pathname: string
readonly method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'
readonly contentType?: 'json' | 'response'
}Ejemplo #
ts
import type { PublicApiEndpoint } from "@meekojs/meeko/framework";
// server/api/users/[id].get.ts
const endpoint: PublicApiEndpoint = { clientKey: "users.byId", pathname: "/api/users/[id]", method: "GET" };Propiedades #
clientKey
#
readonly clientKey: stringRuta del método en el cliente, separada por puntos. Un segmento by + parámetro con mayúscula
inicial es el segmento dinámico de ese parámetro: "users.byId" con /api/users/[id] da
api.users({ id }).get().
contentType
#
readonly contentType?: 'json' | 'response'"response" entrega el Response sin leerlo; por defecto, "json".