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.

ServerRuntimeContext

interfaz

Lo que recibe la fábrica de server/runtime.ts al crear el runtime de la aplicación.

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

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

Declaración #

ts
interface ServerRuntimeContext<Env = Readonly<Record<string, string | undefined>>> {
	readonly env: Env
	readonly production: boolean
	readonly platform: PlatformName
	readonly prerendering: boolean
	readonly root?: string | undefined
}

Type parameters #

Env = Readonly<Record<string, string | undefined>>

Tipo de las variables o bindings del entorno.

Example #

ts
import { defineServerRuntime, MemorySessionStore, SessionManager } from "@meekojs/meeko/server";
import type { ServerRuntimeContext } from "@meekojs/meeko/server";

function sessionsFor({ production, prerendering }: ServerRuntimeContext): SessionManager {
  return new SessionManager({ store: new MemorySessionStore(), production: production && !prerendering });
}
export default defineServerRuntime((context) => ({ sessions: sessionsFor(context) }));

Propiedades #

env #

propiedad sólo lectura

readonly env: Env

Variables de entorno (Node, Deno, Bun) o bindings (Workers).

production #

propiedad sólo lectura

readonly production: boolean

true en producción.

platform #

propiedad sólo lectura

readonly platform: PlatformName

Runtime que ejecuta la aplicación.

prerendering #

propiedad sólo lectura

readonly prerendering: boolean

true mientras meeko build prerenderiza páginas; no se sirve tráfico de clientes.

root #

propiedad sólo lectura opcional since 1.8.0

readonly root?: string | undefined

Ruta absoluta de la raíz del proyecto, para leer sus archivos desde el servidor sin depender de import.meta.url, que el build mueve a .meeko/output/…, ni de process.cwd(). En meeko dev es la raíz del proyecto; en las salidas de Node, Bun y Deno (también en meeko start y en el prerender), la carpeta tres niveles por encima de la salida, o MEEKO_ROOT si está definida (relativa al directorio de trabajo), para una salida que se despliega fuera del proyecto. En Cloudflare Workers, sin sistema de archivos, es undefined, como en un createServerApp propio que no la pasa.

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