Sha256: c9090b9ae7f245be473be23693b65fffd1bdbe47f89bdacdc693842cc220f364

Contents?: true

Size: 521 Bytes

Versions: 17

Compression:

Stored size: 521 Bytes

Contents

/**
 * Module dependencies.
 */

var connect = require('../');

function auth(user, pass) {
  return 'tj' == user && 'tobi' == pass;
}

function authorized(req, res) {
  res.end('authorized!');
}

function hello(req, res) {
  res.end('hello! try /admin');
}

// apply globally

connect(
    connect.basicAuth(auth)
  , authorized
).listen(3000);

// apply to /admin/* only

var server = connect();

server.use('/admin', connect.basicAuth(auth));
server.use('/admin', authorized);
server.use(hello);

server.listen(3001);

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
hooch-0.4.2 jasmine/node_modules/karma/node_modules/connect/examples/basicAuth.js
hooch-0.4.1 jasmine/node_modules/karma/node_modules/connect/examples/basicAuth.js
hooch-0.4.0 jasmine/node_modules/karma/node_modules/connect/examples/basicAuth.js
hooch-0.3.0 jasmine/node_modules/karma/node_modules/connect/examples/basicAuth.js
hooch-0.2.1 jasmine/node_modules/karma/node_modules/connect/examples/basicAuth.js
hooch-0.2.0 jasmine/node_modules/karma/node_modules/connect/examples/basicAuth.js
hooch-0.1.0 jasmine/node_modules/karma/node_modules/connect/examples/basicAuth.js
hooch-0.0.8 jasmine/node_modules/karma/node_modules/connect/examples/basicAuth.js
hooch-0.0.7 jasmine/node_modules/karma/node_modules/connect/examples/basicAuth.js
hooch-0.0.6 jasmine/node_modules/karma/node_modules/connect/examples/basicAuth.js
entangled-0.0.16 spec/dummy/public/node_modules/karma/node_modules/connect/examples/basicAuth.js
entangled-0.0.15 spec/dummy/public/node_modules/karma/node_modules/connect/examples/basicAuth.js
entangled-0.0.14 spec/dummy/public/node_modules/karma/node_modules/connect/examples/basicAuth.js
entangled-0.0.13 spec/dummy/public/node_modules/karma/node_modules/connect/examples/basicAuth.js
entangled-0.0.12 spec/dummy/public/node_modules/karma/node_modules/connect/examples/basicAuth.js
entangled-0.0.11 spec/dummy/public/node_modules/karma/node_modules/connect/examples/basicAuth.js
entangled-0.0.10 spec/dummy/public/node_modules/karma/node_modules/connect/examples/basicAuth.js