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

HttpMiddleware overview

Added in v1.0.0


Table of contents


constructors

cors

Signature

export declare const cors: (
  options?:
    | {
        readonly allowedOrigins?: ReadonlyArray<string> | undefined
        readonly allowedMethods?: ReadonlyArray<string> | undefined
        readonly allowedHeaders?: ReadonlyArray<string> | undefined
        readonly exposedHeaders?: ReadonlyArray<string> | undefined
        readonly maxAge?: number | undefined
        readonly credentials?: boolean | undefined
      }
    | undefined
) => <E, R>(httpApp: App.Default<E, R>) => App.Default<E, R>

Added in v1.0.0

logger

Signature

export declare const logger: <E, R>(httpApp: App.Default<E, R>) => App.Default<E, R>

Added in v1.0.0

make

Signature

export declare const make: <M extends HttpMiddleware>(middleware: M) => M

Added in v1.0.0

searchParamsParser

Signature

export declare const searchParamsParser: <E, R>(
  httpApp: App.Default<E, R>
) => App.Default<E, Exclude<R, ServerRequest.ParsedSearchParams>>

Added in v1.0.0

xForwardedHeaders

Signature

export declare const xForwardedHeaders: <E, R>(httpApp: App.Default<E, R>) => App.Default<E, R>

Added in v1.0.0

fiber refs

currentTracerDisabledWhen

Signature

export declare const currentTracerDisabledWhen: FiberRef.FiberRef<Predicate.Predicate<ServerRequest.HttpServerRequest>>

Added in v1.0.0

loggerDisabled

Signature

export declare const loggerDisabled: FiberRef.FiberRef<boolean>

Added in v1.0.0

withLoggerDisabled

Signature

export declare const withLoggerDisabled: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>

Added in v1.0.0

withTracerDisabledForUrls

Signature

export declare const withTracerDisabledForUrls: {
  (urls: ReadonlyArray<string>): <A, E, R>(layer: Layer.Layer<A, E, R>) => Layer.Layer<A, E, R>
  <A, E, R>(layer: Layer.Layer<A, E, R>, urls: ReadonlyArray<string>): Layer.Layer<A, E, R>
}

Added in v1.0.0

withTracerDisabledWhen

Signature

export declare const withTracerDisabledWhen: {
  (
    predicate: Predicate.Predicate<ServerRequest.HttpServerRequest>
  ): <A, E, R>(layer: Layer.Layer<A, E, R>) => Layer.Layer<A, E, R>
  <A, E, R>(
    layer: Layer.Layer<A, E, R>,
    predicate: Predicate.Predicate<ServerRequest.HttpServerRequest>
  ): Layer.Layer<A, E, R>
}

Added in v1.0.0

withTracerDisabledWhenEffect

Signature

export declare const withTracerDisabledWhenEffect: {
  (
    predicate: Predicate.Predicate<ServerRequest.HttpServerRequest>
  ): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
  <A, E, R>(
    effect: Effect.Effect<A, E, R>,
    predicate: Predicate.Predicate<ServerRequest.HttpServerRequest>
  ): Effect.Effect<A, E, R>
}

Added in v1.0.0

models

HttpMiddleware (interface)

Signature

export interface HttpMiddleware {
  <E, R>(self: App.Default<E, R>): App.Default<any, any>
}

Added in v1.0.0

utils

HttpMiddleware (namespace)

Added in v1.0.0

Applied (interface)

Signature

export interface Applied<A extends App.Default<any, any>, E, R> {
  (self: App.Default<E, R>): A
}

Added in v1.0.0