Interface ServeDirOptions

Interface for serveDir options.

interface ServeDirOptions {
    enableCors?: boolean;
    etagAlgorithm?: AlgorithmIdentifier;
    fsRoot?: string;
    headers?: string[];
    quiet?: boolean;
    showDirListing?: boolean;
    showDotfiles?: boolean;
    showIndex?: boolean;
    urlRoot?: string;
}

Properties

enableCors?: boolean

Enable CORS via the Access-Control-Allow-Origin header.

{false}
etagAlgorithm?: AlgorithmIdentifier

The algorithm to use for generating the ETag.

{"SHA-256"}
fsRoot?: string

Serves the files under the given directory root. Defaults to your current directory.

{"."}
headers?: string[]

Headers to add to each response

{[]}
quiet?: boolean

Do not print request level logs.

{false}
showDirListing?: boolean

Enable directory listing.

{false}
showDotfiles?: boolean

Serves dotfiles.

{false}
showIndex?: boolean

Serves index.html as the index file of the directory.

{true}
urlRoot?: string

Specified that part is stripped from the beginning of the requested pathname.