Node.js demo app for request-id propagation
This implementation shows how to propagate a piece of information (e.g. a request id) and have that value available during the entire request lifecycle.
This is very useful, because we can identify all the log entries that belong to an specific request when handling concurrent requests, without having to pass down these values to every function we call.
This solution uses cls-hooked which only runs on Node >= 8.2.1. For Node version < 8 is recommended to use continuation-local-storage
You need to have the following tools installed on your computer.
- Node.js [8.11.3]. To install Node.js, download it from the Node.js webpage.
To setup the project:
- In the project folder, install the dependencies.
npm install
- Start the project.
Demo server runs locally at http://localhost:3000/.
node index.js