cls-middleware

Connect & Restify middleware to bind routes to continuation-local storage

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
cls-middleware
2061.1.010 years ago11 years agoMinified + gzip package size for cls-middleware in KB

Readme

Connect / Restify middleware for CLS

Dirt-simple middleware for Connect and Restify handlers into a continuation-local storage context.
Example:
var cls     = require('continuation-local-storage');
var express = require('express');
var clsify  = require('cls-middleware');

var ns = cls.createNamespace('namespace');

var app = express();
app.use(clsify(ns));

app.get('/users', function (req, res, next) {
  // clse.getNamespace('namespace').get('whatever') will work here now.
});