You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Move recursive deep-freeze logic into libs/utils.js as
deepFreezeObject() — deep-clones, recursively freezes all
nesting levels, safe for non-plain values (pass-through)
- Cache frozen config in getConfigOptions() after first call
to avoid re-cloning and re-freezing on every invocation
- Use http.STATUS_CODES in parseErr() production mode so
error messages match the status code (e.g. 404 → 'Not Found',
502 → 'Bad Gateway') instead of always 'Internal Server Error'
- Fix documented default errorHandler to match actual
statusCode computation instead of undefined 'code' variable
Copy file name to clipboardExpand all lines: docs/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,7 +80,7 @@ Optionally, learn through examples:
80
80
-`server`: Allows to optionally override the HTTP server instance to be used.
81
81
-`prioRequestsProcessing`: If `TRUE`, HTTP requests processing/handling is prioritized using `setImmediate`. Default value: `TRUE`
82
82
-`defaultRoute`: Optional route handler when no route match occurs. Default value: `((req, res) => res.send(404))`
83
-
-`errorHandler`: Optional global error handler function. Default value: `(err, req, res) => res.send({ code, message: 'Internal Server Error' }, code)`. The default handler returns a generic error message to prevent leaking sensitive internal details (e.g. database connection strings, file paths, stack traces). The appropriate HTTP status code is still preserved from `err.status`, `err.code`, or `err.statusCode`.
83
+
-`errorHandler`: Optional global error handler function. Default value: `(err, req, res) => { const statusCode = typeof (err.status || err.code || err.statusCode) === 'number' ? (err.status || err.code || err.statusCode) : 500; res.send({ code: statusCode, message: 'Internal Server Error' }, statusCode) }`. The default handler returns a generic error message to prevent leaking sensitive internal details (e.g. database connection strings, file paths, stack traces). The appropriate HTTP status code is still preserved from `err.status`, `err.code`, or `err.statusCode`.
84
84
-`routerCacheSize`: The router matching cache size, indicates how many request matches will be kept in memory. Default value: `2000`
85
85
-`enableTrace`: When `TRUE`, the `TRACE` HTTP method handler is available for debugging purposes. Default value: `FALSE`. ⚠️ Not recommended for production deployments.
86
86
-`securityHeaders`: When `TRUE`, default security headers are set on every response. Set to `FALSE` to disable (e.g. when using Helmet or serving non-browser clients). Default value: `TRUE`.
0 commit comments