Optional
trustProxy?: string | boolean | ((address: string, distance: number) => boolean)Optional
subdomainOffset?: numberURL segments to ignore when extracting subdomains from a URL. Defaults to 2
Optional
generateRequestId?: booleanEnabling the flag will generated a unique request id from every HTTP request.
The request id can be accessed using the "request.id()" method. Also,
the value of x-request-id
header is used as the id (if it exists).
Defaults to false
Optional
createRequestId?: {}Optional
allowMethodSpoofing?: booleanMethod spoofing allows changing the request method using the query string. For example: Making a POST request on URL /users/1?_method=PATCH will be handled by the patch route.
Defaults to false
Optional
getIp?: (request: any) => stringA custom implementation to get the request ip address
Optional
etag?: booleanWhether or not to generate etags for responses. Etags can be enabled/disabled when sending response as well.
Defaults to false
Optional
jsonpCallbackName?: stringThe callback name for the JSONP response.
Defaults to 'callback'
Optional
cookie?: {Default options to apply when setting cookies
Optional
domain?: stringDomain name for the cookie
Optional
expires?: Date | (() => Date)Expiration date for the cookie or function that returns the date
Optional
httpOnly?: booleanWhether the cookie should be accessible only through HTTP(S)
Optional
maxAge?: string | numberMaximum age of the cookie in seconds or as a string
Optional
path?: stringURL path for which the cookie is valid
Optional
sameSite?: boolean | "lax" | "none" | "strict"SameSite attribute to control cross-site request behavior
Optional
secure?: booleanWhether the cookie should only be sent over HTTPS
Optional
partitioned?: booleanWhether the cookie should be partitioned (optional)
Optional
priority?: "low" | "medium" | "high"Priority level for the cookie (optional)
Optional
useAsyncLocalStorage?: booleanWhether or not to create an async local storage store for the HTTP context.
Defaults to false
Optional
qs?: {Config for query string parser
Optional
parse?: {Configuration options for parsing query strings
Optional
depth?: numberNesting depth till the parameters should be parsed.
Defaults to 5
Optional
parameterLimit?: numberNumber of parameters to parse.
Defaults to 1000
Optional
allowSparse?: booleanAllow sparse elements in an array.
Defaults to false
Optional
arrayLimit?: numberThe max limimit for the array indices. After the given limit the array indices will be converted to an object, where the index is the key.
Defaults to 20
Optional
comma?: booleanJoin comma seperated query string values to an array
Defaults to false
Optional
stringify?: {Configuration options for stringifying query objects
Optional
encode?: booleanURI encode the stringified query string
Defaults to true
Optional
encodeValuesOnly?: booleanURI encode but only the values and not the keys
Defaults to false
Optional
arrayFormat?: "indices" | "brackets" | "repeat" | "comma"Define the format in which arrays should be serialized.
Defaults to "indices"
Optional
skipNulls?: booleanWhether or not to skip null values when serializing. When set to false, the null values will be treated as an empty string.
Defaults to: false
Optional
keepAliveTimeout?: numberThe number of milliseconds of inactivity a server needs to wait for additional incoming data after it has finished writing the last response.
Optional
headersTimeout?: numberLimit the amount of time the parser will wait to receive the complete HTTP headers.
Optional
requestTimeout?: numberSets the timeout value in milliseconds for receiving the entire request from the client
Optional
timeout?: numberThe number of milliseconds of inactivity before a socket is presumed to have timed out
Define configuration for the HTTP server