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.

ServerServices

tipo

Servicios de la aplicación: un objeto compartido o una función que los crea en cada petición. Llegan a páginas, API, RPC y Socket como RequestContext.services.

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

Source code src/server/runtime/definition.ts:71

Declaración #

ts
type ServerServices<Services, Env = unknown> = Services | ((request: Request, context: { readonly platform: ServerPlatform<Env> }) => Services | Promise<Services>)

Type parameters #

Services

Tipo de los servicios.

Env = unknown

Tipo de las variables o bindings del entorno.

Example #

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

type Services = { readonly region: string; readonly startedAt: number };
const services: ServerServices<Services, { REGION?: string }> = (request, { platform }) => ({
  region: platform.env.REGION ?? "local",
  startedAt: Date.now(),
});

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/definition.ts