Skip to main content
Module

x/momentum/static-files/deps.ts>ServerPlatform

Momentum is an open-source framework for building server-side Deno applications in TypeScript. It provides the paradigms and design patterns to guide developers to create robust, scalable, and enterprise-grade applications.
Latest
class ServerPlatform
extends Platform
Re-export
Abstract
import { ServerPlatform } from "https://deno.land/x/momentum@v0.8.2/static-files/deps.ts";

Momentum platform for server applications such as APIs and web applications.

Constructors

new
ServerPlatform(container: DiContainer)

Methods

abstract
addMiddlewareHandler(handler: (context: unknown) => Promise<boolean>): void | Promise<void>
abstract
addRouteHandler(
controller: ControllerClass,
action: string,
route: string,
controllerMetadata: ControllerMetadata,
actionMetadata: ActionMetadata,
handler: (context: unknown) => unknown,
): void | Promise<void>
abstract
getContextItem(
kind:
| "url"
| "parameter"
| "query"
| "body"
| "cookie"
| "header"
| "state"
| "requestState"
| "request"
| "response"
,
context: unknown,
identifier?: unknown,
): Promise<unknown>
registerGlobalErrorHandler(errorHandler: ErrorHandler, priority?: number)

Register a global error handler.

Register a filter globally. The filter can either be an instance of @see MvFilter or a type that implements @see MvFilter which will be resolved by the platform resolver.

Register a transformer globally. The transformer can either be an instance of @see MvFilter or a type that implements @see MvFilter which will be resolved by the request scoped resolver. *

abstract
sendFile(context: unknown, path: string): void | Promise<void>
abstract
setContextItem(
kind:
| "body"
| "status"
| "cookie"
| "header"
| "status"
| "state"
| "requestState"
,
context: unknown,
value: unknown,
identifier?: unknown,
options?: unknown,
): void | Promise<void>

Provide middleware into the application. The middleware can either be an instance of a @see MvMiddleware or a type that implements @see MvMiddleware which will be resolved by the platform resolver.