Loading config.js +3 −0 Original line number Diff line number Diff line { "host": "localhost", "port": 7777, "keyLength": 6 } lib/document_handler.js +3 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,9 @@ var winston = require('winston'); // For handling serving stored documents var DocumentHandler = function(options) { if (options) { this.keyLength = options.keyLength || 20; } }; // TODO implement with FS backend Loading server.js +6 −2 Original line number Diff line number Diff line Loading @@ -7,8 +7,10 @@ var winston = require('winston'); var StaticHandler = require('./lib/static_handler'); var DocumentHandler = require('./lib/document_handler'); // Load the configuration // Load the configuration and set some defaults var config = JSON.parse(fs.readFileSync('config.js', 'utf8')); config.port = config.port || 7777; config.host = config.host || 'localhost'; // Configure logging - TODO make configurable winston.remove(winston.transports.Console); Loading Loading @@ -40,4 +42,6 @@ http.createServer(function(request, response) { handler = new StaticHandler('./static'); handler.handle(incoming.pathname, response); }).listen(7777); }).listen(config.port, config.host); console.info('listening on ' + config.host + ':' + config.port); Loading
config.js +3 −0 Original line number Diff line number Diff line { "host": "localhost", "port": 7777, "keyLength": 6 }
lib/document_handler.js +3 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,9 @@ var winston = require('winston'); // For handling serving stored documents var DocumentHandler = function(options) { if (options) { this.keyLength = options.keyLength || 20; } }; // TODO implement with FS backend Loading
server.js +6 −2 Original line number Diff line number Diff line Loading @@ -7,8 +7,10 @@ var winston = require('winston'); var StaticHandler = require('./lib/static_handler'); var DocumentHandler = require('./lib/document_handler'); // Load the configuration // Load the configuration and set some defaults var config = JSON.parse(fs.readFileSync('config.js', 'utf8')); config.port = config.port || 7777; config.host = config.host || 'localhost'; // Configure logging - TODO make configurable winston.remove(winston.transports.Console); Loading Loading @@ -40,4 +42,6 @@ http.createServer(function(request, response) { handler = new StaticHandler('./static'); handler.handle(incoming.pathname, response); }).listen(7777); }).listen(config.port, config.host); console.info('listening on ' + config.host + ':' + config.port);