StaticServeOptions
Defined in: src/types.ts:345
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/types.ts:372
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/types.ts:376
Regex or glob patterns to exclude
extensions?
Section titled “extensions?”
optionalextensions: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’]
hooks?
Section titled “hooks?”
optionalhooks:StaticServeHooks<T>
Defined in: src/types.ts:364
Hooks to intercept requests/responses.
index?
Section titled “index?”
optionalindex:string|string[]
Defined in: src/types.ts:360
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/types.ts:355
Whether to list directory contents if no index file is found.
Default
Section titled “Default”falseopenapi?
Section titled “openapi?”
optionalopenapi:MethodAPISpec
Defined in: src/types.ts:385
OpenAPI specification for the static route.
optionalroot:string
Defined in: src/types.ts:350
Root directory to serve files from. Can be an absolute path or relative to the CWD.