Skip to content
Meeko
Type to search the guides and the API reference. Open it from any page with / or Ctrl K; move with the arrow keys and open a result with Enter.
Get started

Contents

On this page

Not translated yet

This page has not been translated into English yet, so it is shown in Spanish.

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";

Source code 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'
}

Example #

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 #

propiedad sólo lectura

readonly clientKey: string

Ruta 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().

pathname #

propiedad sólo lectura

readonly pathname: string

Ruta HTTP con los segmentos dinámicos entre corchetes.

method #

propiedad sólo lectura

readonly method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'

Método HTTP del endpoint.

contentType #

propiedad sólo lectura opcional

readonly contentType?: 'json' | 'response'

"response" entrega el Response sin leerlo; por defecto, "json".

Was this page helpful?

Add a comment

It is sent when you choose “Yes” or “No”. Only the page, your answer and the comment are stored: no cookies and no personal data.

0 of 2000 characters

Edit on GitHub: packages/meeko/src/shared/clients.ts