mirror of
https://github.com/mathew-kurian/Scribe.js
synced 2025-04-24 14:25:00 +00:00
Prepping for heroku
This commit is contained in:
parent
3da6eea33e
commit
84de68de65
5 changed files with 77 additions and 56 deletions
2
Procfile.txt
Normal file
2
Procfile.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
web: node ./examples/webPanel.js
|
||||
|
|
@ -1,13 +1,17 @@
|
|||
/* jshint -W098 */
|
||||
(function () {
|
||||
var scribe = require('../scribe')(),
|
||||
(function() {
|
||||
var scribe = require('../scribe')(),
|
||||
express = require('express'),
|
||||
app = express(),
|
||||
app = express(),
|
||||
console = process.console;
|
||||
|
||||
app.set('port', (process.env.PORT || 5000));
|
||||
|
||||
app.use(scribe.express.logger()); //Log each request
|
||||
|
||||
app.listen(8080, function () {
|
||||
console.time().log('Server listening at port 8080');
|
||||
var port = app.get("port");
|
||||
|
||||
app.listen(port, function() {
|
||||
console.time().log('Server listening at port ' + port);
|
||||
});
|
||||
}());
|
||||
})();
|
||||
|
|
|
@ -1,27 +1,29 @@
|
|||
/* jshint -W098 */
|
||||
(function () {
|
||||
var scribe = require('../scribe')(),
|
||||
(function() {
|
||||
var scribe = require('../scribe')(),
|
||||
express = require('express'),
|
||||
app = express(),
|
||||
app = express(),
|
||||
console = process.console;
|
||||
|
||||
app.set('port', (process.env.PORT || 5000));
|
||||
|
||||
//Create a Console2 for express
|
||||
//with logs saved in /expressLogger
|
||||
var expressConsole = scribe.console({
|
||||
console : {
|
||||
colors : 'white',
|
||||
timeColors : ['grey', 'underline'],
|
||||
console: {
|
||||
colors: 'white',
|
||||
timeColors: ['grey', 'underline'],
|
||||
},
|
||||
createBasic : false,
|
||||
logWriter : {
|
||||
rootPath : 'expressLogger'
|
||||
createBasic: false,
|
||||
logWriter: {
|
||||
rootPath: 'expressLogger'
|
||||
}
|
||||
});
|
||||
|
||||
expressConsole.addLogger('info'); //create a 'info' logger
|
||||
|
||||
//A filter function
|
||||
var validate = function (req, res) {
|
||||
var validate = function(req, res) {
|
||||
|
||||
//if (something) {
|
||||
// return false //ie. don't log this request
|
||||
|
@ -34,7 +36,9 @@
|
|||
//Pass the console and the filter
|
||||
app.use(scribe.express.logger(expressConsole, validate));
|
||||
|
||||
app.listen(8080, function () {
|
||||
console.time().log('Server listening at port 8080');
|
||||
var port = app.get("port");
|
||||
|
||||
app.listen(port, function() {
|
||||
console.time().log('Server listening at port ' + port);
|
||||
});
|
||||
}());
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
/* jshint -W079 */
|
||||
(function () {
|
||||
var scribe = require('../scribe')(),
|
||||
(function() {
|
||||
var scribe = require('../scribe')(),
|
||||
console = process.console,
|
||||
express = require('express'),
|
||||
app = express();
|
||||
app = express();
|
||||
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
app.set('port', (process.env.PORT || 5000));
|
||||
|
||||
app.get('/', function(req, res) {
|
||||
res.send('Hello world, see you at /logs');
|
||||
});
|
||||
|
||||
|
@ -21,10 +23,12 @@
|
|||
console.tag('This is a test').debug('A test');
|
||||
console.tag('An object').log({
|
||||
a: 'b',
|
||||
c : [1, 2, 3]
|
||||
c: [1, 2, 3]
|
||||
});
|
||||
|
||||
app.listen(3000, function () {
|
||||
console.time().log('Server listening at port 3000');
|
||||
var port = app.get("port");
|
||||
|
||||
app.listen(port, function() {
|
||||
console.time().log('Server listening at port ' + port);
|
||||
});
|
||||
}());
|
||||
})();
|
||||
|
|
|
@ -1,37 +1,44 @@
|
|||
/* 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;
|
||||
(function() {
|
||||
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.set('port', (process.env.PORT || 5000));
|
||||
|
||||
app.use('/logs', auth.connect(basicAuth), scribe.webPanel());
|
||||
/**
|
||||
* User : test
|
||||
* Pwd : tes
|
||||
*/
|
||||
var basicAuth = auth.basic({ //basic auth config
|
||||
realm: "ScribeJS WebPanel",
|
||||
file: __dirname + "/users.htpasswd" // test:test
|
||||
});
|
||||
|
||||
//Make some logs
|
||||
console.addLogger('log');
|
||||
console.addLogger('debug', 'inverse');
|
||||
console.addLogger('fun', 'rainbow');
|
||||
app.get('/', function(req, res) {
|
||||
res.send('Hello world, see you at /logs');
|
||||
});
|
||||
|
||||
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.use('/logs', auth.connect(basicAuth), scribe.webPanel());
|
||||
|
||||
app.listen(8080, function () {
|
||||
console.time().log('Server listening at port 8080');
|
||||
});
|
||||
//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]
|
||||
});
|
||||
|
||||
var port = app.get("port");
|
||||
|
||||
app.listen(port, function() {
|
||||
console.time().log('Server listening at port ' + port);
|
||||
});
|
||||
})();
|
||||
|
|
Loading…
Add table
Reference in a new issue