HttpStaticServer
Serves static files for Effect HTTP applications.
HttpStaticServer turns request paths into file responses under a configured root directory. It can be used as an application value or mounted onto an HttpRouter, and it handles index files, optional single-page application fallback, MIME type headers, cache-control headers, byte ranges, and conditional 304 Not Modified responses.
Constructors
Signature
declare const make: (options: { readonly cacheControl?: string; readonly index?: string; readonly mimeTypes?: Record<string, string>; readonly root: string; readonly spa?: boolean;}) => Effect.Effect< Effect.Effect< HttpServerResponse.HttpServerResponse, HttpServerError.HttpServerError, HttpServerRequest.HttpServerRequest >, PlatformError, FileSystem.FileSystem | Path.Path | HttpPlatform.HttpPlatform>;Layers
Creates a layer that mounts static files on an HttpRouter.
Signature
declare function layer(options: { readonly cacheControl?: string; readonly index?: string; readonly mimeTypes?: Record<string, string>; readonly prefix?: string; readonly root: string; readonly spa?: boolean;}): Layer<never, PlatformError, FileSystem | Path | HttpRouter | HttpPlatform>;
Creates an
HttpAppthat serves files from a directory.