<commit_before>'use strict';

const koa = require('koa');
const router = require('./router');
const bodyParser = require('koa-body');
const kcors = require('kcors');

const app = koa();
app.use(kcors());
app.use(bodyParser({
    jsonLimit: '100mb'
}));
app.use(router.routes());

module.exports = app;
<commit_msg>allow to add custom middlewares to the API<commit_after>'use strict';

const koa = require('koa');
const router = require('./router');
const bodyParser = require('koa-body');
const kcors = require('kcors');
const config = require('../config/config');

const app = koa();
app.use(kcors());
app.use(bodyParser({
    jsonLimit: '100mb'
}));

if (config.server && config.server.middleware) {
    config.server.middleware.forEach(middleware => app.use(middleware));
}

app.use(router.routes());

module.exports = app;

{'fraction_non_alphanumeric': 0.19105199516324062, 'fraction_numerical': 0.007255139056831923, 'mean_word_length': 5.369230769230769, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '761220', 'n_tokens_mistral': 279, 'n_tokens_neox': 276, 'n_words': 63}