<commit_before>/**
 * Created by darran on 06/09/14.
 */
'use strict';
var config = require('./../../config/config'),
    User = require('./../../models/shelves/admin/user').User;

var admin = {
    auth: require('./auth'),
    routes: {
        auth: function(requestPath, req, res) {
            admin.auth.router(requestPath, req, res);
        },
        test: function(requestPath, req, res) {
            console.log('admin test:');
            console.log(requestPath);
        }
    },
    app: function(requestPath, req, res)  {
        console.info('cimentarius.admin.app:');
        admin.auth.passport.authenticate('admin-login');
        admin.router(requestPath, req, res);
    },

    router: function(requestPath, req, res) {
        console.info('cimentarius.admin.router: '+JSON.stringify(requestPath));
        console.log("req.isAuthenticated: "+req.isAuthenticated());

        var redirectPrefix = req.url.startsWith('/' +config.admin) ? '/'+ config.admin + '/' : '/';

        if((requestPath[0]=='auth') || (req.isAuthenticated())) {
            console.log(requestPath[0]);
            var route = requestPath.shift();
            if (typeof(admin.routes[route])=='function') {
                admin.routes[route](requestPath, req, res)<commit_msg>Add dashboard to admin router...<commit_after>/**
 * Created by darran on 06/09/14.
 */
'use strict';
var config = require('./../../config/config'),
    User = require('./../../models/shelves/admin/user').User;

var admin = {
    auth: require('./auth'),
    routes: {
        auth: function(requestPath, req, res) {
            admin.auth.router(requestPath, req, res);
        },
        dashboard: function(requestPath, req, res) {
            require('./dashboard').router(requestPath, req, res);
        },
        test: function(requestPath, req, res) {
            console.log('admin test:');
            console.log(requestPath);
        }
    },
    app: function(requestPath, req, res)  {
        console.info('cimentarius.admin.app:');
        admin.auth.passport.authenticate('admin-login');
        admin.router(requestPath, req, res);
    },

    router: function(requestPath, req, res) {
        console.info('cimentarius.admin.router: '+JSON.stringify(requestPath));
        console.log("req.isAuthenticated: "+req.isAuthenticated());

        var redirectPrefix = req.url.startsWith('/' +config.admin) ? '/'+ config.admin + '/' : '/';

        if((requestPath[0]=='auth') || (req.isAuthenticated())) {
            console.log(requestPath[0]);
            var route = requestPath.shift();
            if (typeof(admin.routes[route])=='function') {
                admin.routes[route](requestPath, req, res)
{'fraction_non_alphanumeric': 0.17996289424860853, 'fraction_numerical': 0.005936920222634508, 'mean_word_length': 2.501298701298701, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2853185', 'n_tokens_mistral': 812, 'n_tokens_neox': 794, 'n_words': 140}