forked from mirrors/Scribe.js
WebPanel
This commit is contained in:
parent
e97259e3c0
commit
a9f9dd61c0
2 changed files with 38 additions and 0 deletions
1
examples/users.htpasswd
Normal file
1
examples/users.htpasswd
Normal file
|
@ -0,0 +1 @@
|
||||||
|
test:test
|
37
examples/webPanel_auth.js
Normal file
37
examples/webPanel_auth.js
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
/* jshint -W079 */
|
||||||
|
var auth = require('http-auth'), // @see https://github.com/gevorg/http-auth
|
||||||
|
express = require('express'),
|
||||||
|
app = express(),
|
||||||
|
scribe = require('../scribe')(),
|
||||||
|
console = process.console;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User : test
|
||||||
|
* Pwd : tes
|
||||||
|
*/
|
||||||
|
var basicAuth = auth.basic({ //basic auth config
|
||||||
|
realm : "ScribeJS WebPanel",
|
||||||
|
file : __dirname + "/users.htpasswd" // test:test
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get('/', function (req, res) {
|
||||||
|
res.send('Hello world, see you at /logs');
|
||||||
|
});
|
||||||
|
|
||||||
|
app.use('/logs', auth.connect(basicAuth), scribe.webPanel());
|
||||||
|
|
||||||
|
//Make some logs
|
||||||
|
console.addLogger('log');
|
||||||
|
console.addLogger('debug', 'inverse');
|
||||||
|
console.addLogger('fun', 'rainbow');
|
||||||
|
|
||||||
|
console.time().fun('hello world');
|
||||||
|
console.tag('This is a test').debug('A test');
|
||||||
|
console.tag('An object').log({
|
||||||
|
a: 'b',
|
||||||
|
c : [1, 2, 3]
|
||||||
|
});
|
||||||
|
|
||||||
|
app.listen(8080, function () {
|
||||||
|
console.time().log('Server listening at port 8080');
|
||||||
|
});
|
Loading…
Add table
Reference in a new issue