brettgullan
9/19/2018 - 2:54 AM

Koa Skeleton

Koa Skeleton

const Koa = require('koa')
const { errorHandler, errorLogger } = require('./errors')
const logHandler = require('./logger')
const configHandler = require('./config')

module.exports = ({ routes, logTag }) => {
  const app = new Koa()
  
  app.use(errorHandler)
  app.use(logHandler)
  app.use(configHandler)
  app.use(routes)
  app.on('error', errorLogger)

  return app
}