2014-01-19 13:37:31 +00:00
|
|
|
/**
|
|
|
|
* TODO license
|
|
|
|
* Bouquins module.
|
|
|
|
*/
|
2014-01-22 17:49:50 +00:00
|
|
|
GLOBAL.PATH_RE=/\/([a-zA-Z0-9]+)(?:\/|$)([a-zA-Z0-9]+)?/;
|
2014-01-19 13:37:31 +00:00
|
|
|
|
|
|
|
var config = require('./util/config'),
|
|
|
|
logger = require('./util/logger'),
|
|
|
|
Router = require('./router/router'),
|
|
|
|
bouquins = exports;
|
|
|
|
|
|
|
|
var router = null;
|
|
|
|
/**
|
|
|
|
* Load config file.
|
|
|
|
*/
|
|
|
|
bouquins.loadconfig = function(configfile, callback) {
|
|
|
|
config.loadconfig(configfile, callback);
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* Init logger.
|
|
|
|
*/
|
|
|
|
bouquins.initLogger = function() {
|
|
|
|
if (config.debugLevel) {
|
|
|
|
logger.debugLevel = config.debugLevel;
|
|
|
|
}
|
|
|
|
return logger;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Make main router.
|
|
|
|
*/
|
|
|
|
bouquins.makeRouter = function() {
|
|
|
|
if (!router) {
|
|
|
|
router = new Router();
|
|
|
|
}
|
|
|
|
return router;
|
|
|
|
}
|