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: ServerRequest
  readonly head: Fx.Fx<
    RenderEvent | null,
    never,
    RenderContext.RenderContext | RenderQueue.RenderQueue | RenderTemplate | Scope.Scope
  >
  readonly script: Fx.Fx<
    RenderEvent | null,
    never,
    RenderContext.RenderContext | RenderQueue.RenderQueue | RenderTemplate | Scope.Scope
  >
}

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: Http.app.Default<E, R>
) => Effect.Effect<
  Http.response.ServerResponse,
  E | BadArgument | PlatformError,
  ServerRequest | R | Http.platform.Platform | 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?: {
    layout?: LayoutTemplate<
      Fx.Fx<RenderEvent | null, Router.RouteMatch.RouteMatch.Error<M>, Router.RouteMatch.RouteMatch.Context<M>>,
      E2,
      R2
    >
    base?: string
    environment?: "server" | "static"
  }
): Http.router.Router<
  Router.RouteMatch.RouteMatch.Error<M> | E2 | GuardsNotMatched,
  ServerRequest | 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?: {
    layout?: LayoutTemplate<
      Fx.Fx<RenderEvent | null, Router.RouteMatch.RouteMatch.Error<M>, Router.RouteMatch.RouteMatch.Context<M>>,
      E2,
      R2
    >
    base?: string
  }
): ServerRouter.Router<
  Router.RouteMatch.RouteMatch.Error<M> | E2 | GuardsNotMatched,
  ServerRequest | Exclude<Router.RouteMatch.RouteMatch.Context<M> | R2, Navigation.Navigation | Router.CurrentRoute>
>

Added in v1.0.0