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