<commit_before>'use strict';
var debug = require('debug')('slet')

const http = require('http');
const fs = require('fs')
const resolve = require('path').resolve
const Koa = require('koa');
const methods = require('methods');
const slice = Array.prototype.slice;
const router = require('koa-router')();
const bodyParser = require('koa-bodyparser');
const compose = require('koa-compose')

// local
// const BasicController = require('./controller/BasicController')
// const ViewController = require('./controller/ViewController')
const defaultConfig = require('./config')
const _ctx = defaultConfig.mockCtx
const _next = function(){}

class Slet {
  constructor(opts) {
    this.opts = Object.assign(defaultConfig, opts);

    this.viewPath = resolve(this.opts.root, this.opts.views.path)

    //
    this.app =  new Koa();
    this.routes = []
    this.controllers = []
    this.middlewares = {}

    if (this.opts.debug === true) {
      console.log(this.opts)
    }

    this.routerDir(this.opts.automount.path)
    this._initMiddleware()
    
    this.defineController(require('slet-basiccontroller'))
  }
  
  _initMiddleware() {
    this.middlewares['koa-bodyparser'] = bodyParser()
  }
  
  defineMiddleware(name, fn) {
    this.middlewares[name] = fn
  }
  
  defineController(controller) {
    if (typeof controller === 'function') {
      this.controllers.push(controller)<commit_msg>lazycommmit, please ignore<commit_after>'use strict';
var debug = require('debug')('slet')

const http = require('http');
const fs = require('fs')
const resolve = require('path').resolve
const Koa = require('koa');
const methods = require('methods');
const slice = Array.prototype.slice;
const router = require('koa-router')();
const bodyParser = require('koa-bodyparser');
const compose = require('koa-compose')

// local
// const BasicController = require('./controller/BasicController')
// const ViewController = require('./controller/ViewController')
const defaultConfig = require('./config')
const _ctx = defaultConfig.mockCtx
const _next = function(){}

class Slet {
  constructor(opts) {
    this.opts = Object.assign(defaultConfig, opts);

    this.viewPath = resolve(this.opts.root, this.opts.views.path)

    //
    this.app =  new Koa();
    this.routes = []
    this.controllers = []
    this.middlewares = {}

    if (this.opts.debug === true) {
      console.log(this.opts)
    }
    
    this.defineController(require('slet-basiccontroller'))

    this._initMiddleware()
    this.routerDir(this.opts.automount.path)
  }
  
  _initMiddleware() {
    this.middlewares['koa-bodyparser'] = bodyParser()
  }
  
  defineMiddleware(name, fn) {
    this.middlewares[name] = fn
  }
  
  defineController(controller) {
    if (typeof controller === 'function') {
      this.controllers.push(controller)
{'fraction_non_alphanumeric': 0.15315958586219208, 'fraction_numerical': 0.0, 'mean_word_length': 3.907180385288967, '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': '6361939', 'n_tokens_mistral': 853, 'n_tokens_neox': 850, 'n_words': 167}