Overview
This page provides a comprehensive reference for all configuration options available in Express Zod API. Options are organized by category.Common Configuration
These options are available in all configurations:cors
boolean | HeadersProvider
required
Enables cross-origin resource sharing (CORS)
boolean | HeadersProvider
Required: Yes
Default: N/A (must be explicitly set)
Examples:
logger
Type:BuiltinLoggerConfig | AbstractLogger
Default: { level: "debug", color: true, depth: 2 }
Built-in Logger Options:
Examples:
errorHandler
Type:AbstractResultHandler
Default: defaultResultHandler
Description: Handles routing, parsing, and upload errors.
inputSources
Type:Partial<InputSources>
Default:
input.
childLoggerProvider
Type:(params: { parent: Logger; request: Request }) => Logger | Promise<Logger>
Default: None
Description: Creates a request-scoped child logger.
accessLogger
Type:((request: Request, logger: Logger) => void) | null
Default: ({ method, path }, logger) => logger.debug(${method}: ${path})
Description: Logs each request. Set to null to disable.
wrongMethodBehavior
Type:404 | 405
Default: 405
Description: HTTP status code when wrong method is used.
404: Returns Not Found405: Returns Method Not Allowed withAllowheader
methodLikeRouteBehavior
Type:"method" | "path"
Default: "method"
Description: How to treat routing keys that match HTTP method names.
startupLogo
Type:boolean
Default: true
Description: Show ASCII logo on server start.
Server Configuration
These options are for standalone servers (usingcreateServer()):
http
Type:{ listen: number | string | ListenOptions }
Description: HTTP server configuration.
https
Type:{ options: ServerOptions; listen: number | string | ListenOptions }
Description: HTTPS server with TLS certificates.
beforeRouting
Type:(params: { app: Express; getLogger: GetLogger }) => void | Promise<void>
Description: Configure Express app before routes are attached.
jsonParser
Type:RequestHandler | false
Default: express.json()
Description: JSON body parser or false to disable.
formParser
Type:RequestHandler | false
Default: express.urlencoded({ extended: false })
Description: Form body parser or false to disable.
upload
Type:boolean | UploadOptions
Description: Enable file uploads.
Options:
compression
Type:boolean | CompressionOptions
Description: Enable GZIP/Brotli compression.
queryParser
Type:"simple" | "extended" | ((str: string) => any)
Default: "simple"
Description: Query string parser.
gracefulShutdown
Type:GracefulShutdownConfig
Options:
App Configuration
These options are for attaching to an existing Express app:app
Type:Express | Router
Required: Yes (for app config)
Description: Express application or router instance.
Type Definitions
InputSource
InputSources
Method
HeadersProvider
See Also
createConfig
Create a configuration object
createServer
Start a server with configuration
Production Mode
Production deployment settings
CORS
Configure CORS in detail