I have a question
See original GitHub issueHi, I’m so impressed by cls-rtracer so I researched about cls and cls-hooked.
I’m creating my module using cls-hooked to learn deeply.
I’ve following and trying this post: here
However, It’s a little bit different implemented code against your code. https://github.com/puzpuzpuz/cls-rtracer/blob/master/index.js#L61
And my code is :
const traceId = (opts: { test: number } | undefined): Middleware => {
return async (ctx: Context, next: Function) => {
// req and res are event emitters. We want to access CLS context inside of their event callbacks
clsNamespace.bindEmitter(ctx.req);
clsNamespace.bindEmitter(ctx.res);
const traceID = uuidv4();
clsNamespace.run(() => {
clsNamespace.set('traceID', traceID);
return next();
});
};
};
I’m wondering why you didn’t use clsNamespace.run() . I think I’m not enough to understand at all. Is it same working code?
best wishes.
Steve.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
I Have Questions - Wikipedia
"I Have Questions" is a song recorded by Cuban-American singer and songwriter Camila Cabello. It was first featured as an intro on the...
Read more >Camila Cabello – I Have Questions Lyrics - Genius
[Chorus 1] I have questions for you. Number one, tell me who you think you are. You got some nerve trying to tear...
Read more >Children's Books | I Have a Question
The I Have a Question book series offers clear answers for all kids on life's most challenging topics.
Read more >tense - "I had a question" or "I have a question"
It's true that a more oblique or indirect expression can sound more polite. In approximate order of increasing politeness/deference, ...
Read more >Which one is correct? 'I have a question for/to you' - Quora
The correct word is neither to or from, but “of.” You might say, “I would like to ask a few questions of Mr....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@love8587 no problem at all. I’m glad to be able to help.
I’ll close this issue as the question seems to be answered. Feel free to reopen it or create another one.
@puzpuzpuz many thanks. That’s very important and helpful to me. My code is starting to look very similar to your code. 😃