<commit_before>var MWCKernel = require('kabam-kernel'),
  express = require('express'),
  url = require('url'),
  path = require('path'),
  ENV = process.env.NODE_ENV || 'development',
  config = require('./config/config.json')[ENV];

//setting up the config
var MWC = MWCKernel(config);

MWC.extendApp(function (core) {
  core.app.locals.delimiters = '[[ ]]';
});

MWC.usePlugin(require('kabam-plugin-hogan'));

var protectorMiddlewareFunction = function (mwc) {
  return function (request, response, next) {
    if (request.user) {
      if (request.user.hasRole('worker') || request.user.hasRole('supervisor')) {
        next();
      } else {
        //this user is NOT INVITED!!!
        response.send(403, 'Sorry, you can\'t work, you need permission from supervisor!');
        return;
      }
    } else {
      next();
    }
  };
};

MWC.extendMiddleware(['development', 'staging', 'production'], '/api', protectorMiddlewareFunction);
//MWC.extendMiddleware(['development', 'staging', 'production'], '/data-entry', protectorMiddlewareFunction);

MWC.usePlugin(require('kabam-plugin-rest'));
MWC.extendModel('Colleges', require('./models/colleges.js'));


MWC.extendMiddleware('development', function (core) {
  return express.static(path.join(__dirname, 'public'));
});
MWC.extendMiddleware('development', function (core) {
  return express.static(path.join(__dirname, '.tmp'));
});

MWC.extendMiddleware('production', function (core) {
  return express.static(path.join(__dirname, 'dist/public'));
});



MWC.extendRoutes(function (core) {
  core.app.get('/*', function (request, response, next) {
    //TODO: any methods on a user to get a frontend-friendly profile?
    var user = {};
    if(request.user){
      user = {
        'username':request.user.username,
        'email':request.user.email
      }
    }
    response.render('index', {
      user: JSON.stringify(user).replace('</', '<\/')
    });
  });
});

MWC.start();
<commit_msg>[feature] /d/* routes are reserved for angular routes [feature] - user profile is exported with many parts in it<commit_after>var MWCKernel = require('kabam-kernel'),
  express = require('express'),
  url = require('url'),
  path = require('path'),
  ENV = process.env.NODE_ENV || 'development',
  config = require('./config/config.json')[ENV];

//setting up the config
var MWC = MWCKernel(config);

MWC.extendApp(function (core) {
  core.app.locals.delimiters = '[[ ]]';
});

MWC.usePlugin(require('kabam-plugin-hogan'));

var protectorMiddlewareFunction = function (mwc) {
  return function (request, response, next) {
    if (request.user) {
      if (request.user.hasRole('worker') || request.user.hasRole('supervisor')) {
        next();
      } else {
        //this user is NOT INVITED!!!
        response.send(403, 'Sorry, you can\'t work, you need permission from supervisor!');
        return;
      }
    } else {
      next();
    }
  };
};

MWC.extendMiddleware(['development', 'staging', 'production'], '/api', protectorMiddlewareFunction);
//MWC.extendMiddleware(['development', 'staging', 'production'], '/data-entry', protectorMiddlewareFunction);

MWC.usePlugin(require('kabam-plugin-rest'));
MWC.extendModel('Colleges', require('./models/colleges.js'));


MWC.extendMiddleware('development', function (core) {
  return express.static(path.join(__dirname, 'public'));
});
MWC.extendMiddleware('development', function (core) {
  return express.static(path.join(__dirname, '.tmp'));
});

MWC.extendMiddleware('production', function (core) {
  return express.static(path.join(__dirname, 'dist/public'));
});



MWC.extendRoutes(function (core) {
  core.app.get('/d/*', function (request, response, next) {
    var user = {};
    if(request.user){
      user = request.user.export();
    } 
    response.render('index', {
      user: JSON.stringify(user).replace('</', '<\/')
    });
  });
});

MWC.start();

{'fraction_non_alphanumeric': 0.18472652218782248, 'fraction_numerical': 0.0015479876160990713, 'mean_word_length': 3.98970398970399, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3881253', 'n_tokens_mistral': 1229, 'n_tokens_neox': 1207, 'n_words': 241}