Skip to main content Link Search Menu Expand Document (external link)

Platform overview

Added in v1.0.0


Table of contents


utils

GuardsNotMatched (class)

Signature

export declare class GuardsNotMatched

Added in v1.0.0

LayoutParams (type alias)

Signature

export type LayoutParams<Content extends Fx.Fx<RenderEvent | null, any, any>> = {
  readonly content: Content
  readonly request: HttpServerRequest
  readonly head: Fx.Fx<
    RenderEvent | null,
    never,
    RenderContext.RenderContext | RenderQueue.RenderQueue | RenderTemplate | Scope.Scope
  > | null
  readonly script: Fx.Fx<
    RenderEvent | null,
    never,
    RenderContext.RenderContext | RenderQueue.RenderQueue | RenderTemplate | Scope.Scope
  > | null
}

Added in v1.0.0

LayoutTemplate (type alias)

Signature

export type LayoutTemplate<Content extends Fx.Fx<RenderEvent | null, any, any>, E, R> = (
  params: LayoutParams<Content>
) => Fx.Fx<RenderEvent | null, E, R>

Added in v1.0.0

getContentType

Signature

export declare const getContentType: (filePath: string) => string

Added in v1.0.0

staticFiles

A very simple static file middleware with support for gzip’d files.

Signature

export declare function staticFiles({
  cacheControl,
  enabled,
  options,
  serverOutputDirectory
}: {
  serverOutputDirectory: string
  enabled: boolean
  options: TypedOptions
  cacheControl?: (filePath: string) => {
    readonly maxAge: number
    readonly immutable?: boolean
  }
}): <E, R>(
  self: HttpApp.Default<E, R>
) => Effect.Effect<
  HttpServerResponse.HttpServerResponse,
  E | BadArgument | PlatformError,
  HttpServerRequest | R | HttpPlatform | FileSystem | Path
>

Added in v1.0.0

toHttpRouter

Signature

export declare function toHttpRouter<
  M extends Router.RouteMatch.RouteMatch<Route.Route.Any, any, any, any, RenderEvent | null, any, any>,
  E2 = never,
  R2 = never
>(
  matcher: Router.RouteMatcher<M>,
  options?: {
    clientEntry?: string
    layout?: LayoutTemplate<
      Fx.Fx<RenderEvent | null, Router.RouteMatch.RouteMatch.Error<M>, Router.RouteMatch.RouteMatch.Context<M>>,
      E2,
      R2
    >
    base?: string
    environment?: "server" | "static"
  }
): HttpRouter.HttpRouter<
  Router.RouteMatch.RouteMatch.Error<M> | E2 | GuardsNotMatched,
  HttpServerRequest | Exclude<Router.RouteMatch.RouteMatch.Context<M> | R2, Navigation.Navigation | Router.CurrentRoute>
>

Added in v1.0.0

toServerRouter

Signature

export declare function toServerRouter<
  M extends Router.RouteMatch.RouteMatch<Route.Route.Any, any, any, any, RenderEvent | null, any, any>,
  E2 = never,
  R2 = never
>(
  matcher: Router.RouteMatcher<M>,
  options?: {
    clientEntry?: string
    layout?: LayoutTemplate<
      Fx.Fx<RenderEvent | null, Router.RouteMatch.RouteMatch.Error<M>, Router.RouteMatch.RouteMatch.Context<M>>,
      E2,
      R2
    >
    base?: string
  }
): ServerRouter.HttpRouter<
  Router.RouteMatch.RouteMatch.Error<M> | E2 | GuardsNotMatched,
  HttpServerRequest | Exclude<Router.RouteMatch.RouteMatch.Context<M> | R2, Navigation.Navigation | Router.CurrentRoute>
>

Added in v1.0.0