Skip to content

HEW for Express

Jason Marshall edited this page Feb 23, 2020 · 2 revisions

hew-express

An Express application, configured for production.

Requirements

  • disable permissive Express settings
  • log only in json format to simplify log analysis
  • add correlation ID to all logs
  • add correlation ID to all outbound requests
  • handle unhandled errors and promises
  • shut down on SIGINT
  • health endpoint
  • do not make the user repeat configuration per file - this is how information gets lost
  • leave space for subprojects to add other tools (eg, handlebars, sass/less)

Assumptions

Most likely, this app will be run inside of a docker container, and we will be logging to stdout and stderr. Almost all of the log messages will be in the same format, except the access logs.

But these servers will never be exposed directly to the internet. If we let the load balancer be responsible for access logs, we avoid double logging, the timing is a little more accurate (async code in Nodejs can result in some jitter), and we don't have to figure out how to segregate the combined logging later on.

Clone this wiki locally