src/index.js   A
last analyzed

Complexity

Total Complexity 6
Complexity/F 1.5

Size

Lines of Code 29
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
wmc 6
c 1
b 0
f 0
nc 1
mnd 1
bc 5
fnc 4
dl 0
loc 29
rs 10
bpm 1.25
cpm 1.5
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A index.js ➔ ??? 0 6 2
1
'use strict'
2
3
import server from './server'
4
import chalk from 'chalk'
5
import logger from 'winston'
6
import config from '../config'
7
import databaseConnection, { databaseValidate } from './database'
8
import beforeServerListen from './cluster'
9
import endpoints from './helpers/endpoints'
10
11
// Verify `cluster` need
12
beforeServerListen(() => {
13
  if (config.isDevelop) {
14
    console.log(endpoints.listAll(server))
15
  }
16
  server.listen(config.server.port, () => databaseConnection(config.uri.db))
17
})
18
19
Promise.all([databaseValidate])
20
  .then(() => {
21
    logger.info('[app]', `Restify started in ${chalk.bold(config.env)}` +
22
                ` mode on ${chalk.cyan(server.url)}` +
23
                '; press Ctrl-C to terminate.')
24
  })
25
  .catch((error) => {
26
    if (error instanceof Error) {
27
      logger.error('[app]', error.stack)
28
    }
29
  })
30