node-debug-switcher
Switch NODE_DEBUG per request.
Usage
Express 4.0
var express = require('express');
var cookieParser = require('cookie-parser');
var switcher = require('node-debug-switcher').express;
app = express();
app.use(cookieParser());
// Switch by cookie
app.use(switcher('name', type: 'cookie'));
// Switch by query
app.use(switcher('name', type: 'query'));
Koa
var koa = require('koa');
var switcher = require('node-debug-switcher').koa;
app = koa();
// Switch by cookie
app.use(switcher('name', type: 'cookie'));
// Switch by query
app.use(switcher('name', type: 'query'));
Options
Secure
Encrypt the value.
switcher = require('node-debug-switcher').koa
switcher('name', secure: true, password: 'foo', type: 'cookie')
Execute node-debug-switcher <string_to_encrypt> <password>
to get the encrypted value.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Copyright
Copyright (c) 2014 Daisuke Taniwaki. See LICENSE for details.