I hereby claim:
- I am jcperez on github.
- I am jc_perez91 (https://keybase.io/jc_perez91) on keybase.
- I have a public key ASDt_BIUBLuHmZEDv_XaYGu347GvkAzenw0xo0mfGIyIwwo
To claim this, I am signing this object:
const express = require('express'); | |
const app = express(); | |
const namespace = require('cls-hooked').createNamespace; | |
const session = namespace('demo-session'); | |
function createNamespace(req, res, next) { | |
session.run(function () { | |
const requestId = req.get('request-id') || generateRequestId(); | |
session.set('request-id', requestId); |
function logger(message) { | |
console.log(`${session.get('request-id')} - ${message}`); | |
} | |
app.get('/', (req, res) => { | |
logger(`Request to ${req.path}`); | |
res.send(`Request completed - ${session.get('request-id')}`); | |
}); |
I hereby claim:
To claim this, I am signing this object:
AKIAJCNXDPKYNSY3AQ3Q