Skip to content

StaticServeOptions

Defined in: src/types.ts:345

T extends Record<string, any>

optional dotfiles: "allow" | "deny" | "ignore"

Defined in: src/types.ts:372

How to treat dotfiles (files starting with .) ‘allow’: Serve them ‘deny’: Return 403 ‘ignore’: Return 404

'ignore'

optional exclude: (string | RegExp)[]

Defined in: src/types.ts:376

Regex or glob patterns to exclude


optional extensions: string[]

Defined in: src/types.ts:381

Try to append these extensions to the path if the file is not found. e.g. [‘html’, ‘htm’]


optional hooks: StaticServeHooks<T>

Defined in: src/types.ts:364

Hooks to intercept requests/responses.


optional index: string | string[]

Defined in: src/types.ts:360

Index file(s) to look for when a directory is requested.

['index.html', 'index.htm']

optional listDirectory: boolean

Defined in: src/types.ts:355

Whether to list directory contents if no index file is found.

false

optional openapi: MethodAPISpec

Defined in: src/types.ts:385

OpenAPI specification for the static route.


optional root: string

Defined in: src/types.ts:350

Root directory to serve files from. Can be an absolute path or relative to the CWD.