Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

std/http/mod.ts>ServeDirOptions

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
interface ServeDirOptions
import { type ServeDirOptions } from "https://deno.land/std@0.218.0/http/mod.ts";

Interface for serveDir options.

Properties

optional
fsRoot: string = "."

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

optional
urlRoot: string = undefined

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

optional
showDirListing: boolean = false

Enable directory listing.

optional
showDotfiles: boolean = false

Serves dotfiles.

optional
showIndex: boolean = true

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

optional
enableCors: boolean = false

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

optional
quiet: boolean = false

Do not print request level logs. Defaults to false.

optional
etagAlgorithm: AlgorithmIdentifier = "SHA-256"

The algorithm to use for generating the ETag.

optional
headers: string[] = []

Headers to add to each response