StaticServeOptions
Defined in: src/util/types.ts:427
Type Parameters
Section titled “Type Parameters”T extends Record<string, any>
Properties
Section titled “Properties”dotfiles?
Section titled “dotfiles?”
optionaldotfiles:"allow"|"deny"|"ignore"
Defined in: src/util/types.ts:458
How to treat dotfiles (files starting with .) ‘allow’: Serve them ‘deny’: Return 403 ‘ignore’: Return 404
Default
Section titled “Default”'ignore'exclude?
Section titled “exclude?”
optionalexclude: (string|RegExp)[]
Defined in: src/util/types.ts:462
Regex or glob patterns to exclude
extensions?
Section titled “extensions?”
optionalextensions:string[]
Defined in: src/util/types.ts:467
Try to append these extensions to the path if the file is not found. e.g. [‘html’, ‘htm’]
hooks?
Section titled “hooks?”
optionalhooks:StaticServeHooks<T>
Defined in: src/util/types.ts:450
Hooks to intercept requests/responses.
index?
Section titled “index?”
optionalindex:string|string[]
Defined in: src/util/types.ts:446
Index file(s) to look for when a directory is requested.
Default
Section titled “Default”['index.html', 'index.htm']listDirectory?
Section titled “listDirectory?”
optionallistDirectory:boolean
Defined in: src/util/types.ts:441
Whether to list directory contents if no index file is found.
Security Note: Directory listing is disabled by default to prevent information disclosure. Enable this only if you specifically need it and understand the security implications.
Default
Section titled “Default”falseopenapi?
Section titled “openapi?”
optionalopenapi:MethodAPISpec
Defined in: src/util/types.ts:471
OpenAPI specification for the static route.
optionalroot:string
Defined in: src/util/types.ts:432
Root directory to serve files from. Can be an absolute path or relative to the CWD.