<commit_before>var Ovenware = require('ovenware');
var Router = require('koa-router');
var debug = require('debug')('koa-ovenware');

var ow = Ovenware.prototype;

ow.middleware = function() {
  var ow = this;
  var app = this.app;
  var context = app.context;
  var router = new Router(app);

  app.use(router.middleware());

  function getObj(obj) {
    return function(name) {
      name = name || router.match(this.path)[0].route.name;
      return ow[obj][name.toLowerCase()];
    };
  }
  context.ctrl = getObj('ctrls');
  context.model = getObj('models');
};

ow.route = function(method, name, path, handler, handlerName) {
  debug('Route Added:  %s %s - [%s] -> %s', method.toUpperCase(), path, name, handlerName);

  this.app[method](name, path, this.preprocess(handler));
};

module.exports = Kow;

function Kow(app, options) {
  return new Ovenware(app, options);
}<commit_msg>expose ovenware directly<commit_after>var Ovenware = require('ovenware');
var Router = require('koa-router');
var debug = require('debug')('koa-ovenware');

var ow = Ovenware.prototype;

ow.middleware = function() {
  var ow = this;
  var app = this.app;
  var context = app.context;
  var router = new Router(app);

  app.use(router.middleware());

  function getObj(obj) {
    return function(name) {
      name = name || router.match(this.path)[0].route.name;
      return ow[obj][name.toLowerCase()];
    };
  }
  context.ctrl = getObj('ctrls');
  context.model = getObj('models');
};

ow.route = function(method, name, path, handler, handlerName) {
  debug('Route Added:  %s %s - [%s] -> %s', method.toUpperCase(), path, name, handlerName);

  this.app[method](name, path, this.preprocess(handler));
};

module.exports = Ovenware;
{'fraction_non_alphanumeric': 0.1746952988972722, 'fraction_numerical': 0.0011607661056297156, 'mean_word_length': 4.20845921450151, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1483429', 'n_tokens_mistral': 599, 'n_tokens_neox': 589, 'n_words': 133}