cls-middleware
cls-middleware copied to clipboard
made example in readme runnable
The most important fix was getNameSpace => getNamespace but also the removal of the superfluous "next()" in the route (necessary for restify but makes express crash with "Error: Can't set headers after they are sent".
The example also crashed on the ns.set with "Error: No context available. ns.run() or ns.bind() must be called first." so I introduced a naive requestId middleware to set something in the request call chain.