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.

ServerApp

interfaz

Aplicación portable: cada adaptador traduce sus peticiones a fetch. La crea createServerApp.

ts
import type { ServerApp } from "@meekojs/meeko/server";

Source code src/server/runtime/app.ts:269

Declaración #

ts
interface ServerApp {
	fetch(request: Request, platform?: ServerPlatform): Promise<Response>
	readonly socket?: ServerAppSocket
	readonly manifest: AppManifest
	readonly publicOrigin?: string
	reportError(error: unknown, requestId: string, info?: ServerErrorInfo): void
	close(): Promise<void>
}

Example #

ts
const response = await app.fetch(new Request("http://localhost/api/health"));
console.log(response.status);
await app.close();

Miembros #

fetch #

método

fetch(request: Request, platform?: ServerPlatform): Promise<Response>

Atiende una petición: middleware, assets, páginas, API y RPC.

socket #

propiedad sólo lectura opcional

readonly socket?: ServerAppSocket

Existe cuando la aplicación declara canales Socket.

manifest #

propiedad sólo lectura

readonly manifest: AppManifest

Manifiesto de la aplicación.

publicOrigin #

propiedad sólo lectura opcional

readonly publicOrigin?: string

Origen público con el que se comprueba Origin.

reportError #

método

reportError(error: unknown, requestId: string, info?: ServerErrorInfo): void

Envía un fallo del transporte al mismo observador que los fallos de las peticiones. Desde 1.3, info identifica un fallo del proceso y llega al observador como tercer argumento.

close #

método

close(): Promise<void>

Espera las tareas en segundo plano registradas en la plataforma de la aplicación, como las de los callbacks de Socket, y después cierra las sesiones y los recursos del runtime.

See also #

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/server/runtime/app.ts