DenoServeOptions
Options shared by serve() of the native runtimes. (DenoServeOptions of @shadow-js/dusk/deno)
Options shared by serve() of the native runtimes.
Import#
ts
import type { DenoServeOptions } from "@shadow-js/dusk/deno";
Signature#
ts
interface NativeServeOptions {
/** Port to listen on. Default: `process.env.PORT`, else 3000. `0` picks a free one. */
readonly port?: number;
/** Interface to listen on. Default `"127.0.0.1"`. The generated entries use `HOST`, default `0.0.0.0`. */
readonly hostname?: string;
/** Absolute folder of the client build, served before the handler. `false` serves no files. */
readonly static?: string | false;
/**
* The URL path the static folder is served under: the app's base (`/app`). A request outside it is not a
* static file. Default `"/"`, the root.
*/
readonly prefix?: string;
/** The build's assets folder (Vite's `build.assetsDir`), for the immutable rule of hashed files. Default `"assets"`. */
readonly assetsDir?: string;
/**
* Gzip for buffered text responses (those with a `Content-Length`). Streamed responses are not
* compressed: the gzip stream would hold every chunk back until the end. Default `true`.
*/
readonly compress?: boolean;
/** Time a stop waits for requests in flight before it closes them, in milliseconds. Default 10 000. */
readonly gracefulShutdownMs?: number;
/** Signals that start a graceful stop. Default `["SIGTERM", "SIGINT"]`; `false` registers none. */
readonly shutdownSignals?: false | readonly string[];
/** Exit the process after a signal-triggered stop. Default `true`. */
readonly exitOnSignal?: boolean;
/** Receives failures that cannot reach the client. Default: `console.error`. */
readonly onError?: (error: unknown) => void;
/**
* The prerendered pages and how each is answered (see {@link StaticPage}): a `handler` page is rendered per request,
* a `static` page is served from its file with the app's headers. Default: none.
*/
readonly pages?: readonly StaticPage[];
}
Members#
| Name | Type | Description |
|---|---|---|
port? |
readonly port?: number |
Port to listen on. Default: process.env.PORT, else 3000. 0 picks a free one. |
hostname? |
readonly hostname?: string |
Interface to listen on. Default "127.0.0.1". The generated entries use HOST, default 0.0.0.0. |
static? |
readonly static?: string | false |
Absolute folder of the client build, served before the handler. false serves no files. |
prefix? |
readonly prefix?: string |
The URL path the static folder is served under: the app's base (/app). A request outside it is not a static file. Default "/", the root. |
assetsDir? |
readonly assetsDir?: string |
The build's assets folder (Vite's build.assetsDir), for the immutable rule of hashed files. Default "assets". |
compress? |
readonly compress?: boolean |
Gzip for buffered text responses (those with a Content-Length). Streamed responses are not compressed: the gzip stream would hold every chunk back until the end. Default true. |
gracefulShutdownMs? |
readonly gracefulShutdownMs?: number |
Time a stop waits for requests in flight before it closes them, in milliseconds. Default 10 000. |
shutdownSignals? |
readonly shutdownSignals?: false | readonly string[] |
Signals that start a graceful stop. Default ["SIGTERM", "SIGINT"]; false registers none. |
exitOnSignal? |
readonly exitOnSignal?: boolean |
Exit the process after a signal-triggered stop. Default true. |
onError? |
readonly onError?: (error: unknown) => void |
Receives failures that cannot reach the client. Default: console.error. |
pages? |
readonly pages?: readonly StaticPage[] |
The prerendered pages and how each is answered (see StaticPage): a handler page is rendered per request, a static page is served from its file with the app's headers. Default: none. |