Socket
Book a DemoInstallSign in
Socket

connect-testab

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-testab

Just a simple A/B test middleware

0.0.1
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

connect-testab

Just a simple A/B testing middleware for connect.

Install

$ npm install connect-testab

Usage

var connect = require('connect'),
testAB = require('connect-testab'),
app = connect();
app.use(connect.cookieParser());
app.use(testAB());
app.get('/', function(req, res){
    res.send('test ' + req.testAB);
});

See a full express example

By default the test will be persisted on a cookie for 7 days. You can change this value by providing a new time in milisecs.

var connect = require('connect'),
testAB = require('connect-testab'),
ONE_DAY = 24 * 60 * 60 * 1000;
app = connect();
app.use(connect.cookieParser());
app.use(testAB(ONE_DAY));
app.get('/', function(req, res){
    res.send('test ' + req.testAB);
});

If you do not want to persist it on a cookie just pass a -1

var connect = require('connect'),
testAB = require('connect-testab'),
NO_COOKIES = -1;
app = connect();
app.use(connect.cookieParser());
app.use(testAB(NO_COOKIES));
app.get('/', function(req, res){
    res.send('test ' + req.testAB);
});

License

MIT. See LICENSE file.

Keywords

test A/B

FAQs

Package last updated on 22 Aug 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.