All files / koa app.js

73.68% Statements 14/19
50% Branches 2/4
66.67% Functions 2/3
77.78% Lines 14/18

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28    5x 5x 5x 5x 5x 5x   5x 5x 5x   5x 23x     5x 10x                 5x
'use strict'
 
const Koa = require('koa')
const app = new Koa()
const config = require('./config/env')
require('./db')
const {errorMid} = require('./middleware')
Iif (config.seedDB) { require('./config/seed')() }
 
app.use(errorMid())
require('./config/horse')(app, config)
require('./routes')(app)
 
app.on('error', (err, ctx) => {
  console.error('----app--error---->', err)
})
 
process.on('message', function (msg) {
  Iif (msg === 'shutdown') {
    console.log('---- Closing all connections... ----')
    setTimeout(function () {
      console.log('---- Finished closing connections ----')
      process.exit(0)
    }, 1000)
  }
});
 
module.exports = app