Code coverage report for server/app/configure/app-variables.js

Statements: 100% (19 / 19)      Branches: 100% (0 / 0)      Functions: 100% (2 / 2)      Lines: 100% (19 / 19)      Ignored: none     

All files » server/app/configure/ » app-variables.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27  1 1 1   1 1 1   1   1 3 3 3 3 3     1 2 2 2 2 2    
'use strict';
var path = require('path');
var chalk = require('chalk');
var util = require('util');
 
var rootPath = path.join(__dirname, '../../../');
var indexPath = path.join(rootPath, './server/app/views/index.html');
var faviconPath = path.join(rootPath, './server/app/views/favicon.ico');
 
var env = require(path.join(rootPath, './server/env'));
 
var logMiddleware = function (req, res, next) {
    util.log(('---NEW REQUEST---'));
    console.log(util.format(chalk.red('%s: %s %s'), 'REQUEST ', req.method, req.path));
    console.log(util.format(chalk.yellow('%s: %s'), 'QUERY   ', util.inspect(req.query)));
    console.log(util.format(chalk.cyan('%s: %s'), 'BODY    ', util.inspect(req.body)));
    next();
};
 
module.exports = function (app) {
    app.setValue('env', env);
    app.setValue('projectRoot', rootPath);
    app.setValue('indexHTMLPath', indexPath);
    app.setValue('faviconPath', faviconPath);
    app.setValue('log', logMiddleware);
};