<commit_before>const koa = require('koa')
const qs = require('koa-qs')
const serve = require('koa-static')
const log = require('debug')('quad-blog:server')
const responseTime = require('koa-response-time')

log('loading api and models')
const modelLoader = require('./models')
const apiLoader = require('./api')

log('loading and building config')
const configMaker = require('./config')
const config = configMaker()

log('initializing models and api')
const models = modelLoader(config.database)
const api = apiLoader({models})

/**
 * Server
 */
const server = qs(koa())
Object.assign(server, {
  env: config.env,
  config,
  models,
  api
})

/**
 * Middleware
 */

// request logging
if (server.env === 'development') {
  const logger = require('koa-logger')
  server.use(logger())
}

// x-response-time
server.use(responseTime())

// file server
server.use(serve('./public'))

/**<commit_msg>Add static folder server<commit_after>const koa = require('koa')
const qs = require('koa-qs')
const serve = require('koa-static')
const log = require('debug')('quad-blog:server')
const responseTime = require('koa-response-time')

log('loading api and models')
const modelLoader = require('./models')
const apiLoader = require('./api')

log('loading and building config')
const configMaker = require('./config')
const config = configMaker()

log('initializing models and api')
const models = modelLoader(config.database)
const api = apiLoader({models})

/**
 * Server
 */
const server = qs(koa())
Object.assign(server, {
  env: config.env,
  config,
  models,
  api
})

/**
 * Middleware
 */

// request logging
if (server.env === 'development') {
  const logger = require('koa-logger')
  server.use(logger())
}

// x-response-time
server.use(responseTime())

// file server
server.use(serve('./static'))
server.use(serve('./public'))

/**
{'fraction_non_alphanumeric': 0.1760217983651226, 'fraction_numerical': 0.0, 'mean_word_length': 4.7375, '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': '6215413', 'n_tokens_mistral': 575, 'n_tokens_neox': 572, 'n_words': 144}