2020-11-15 15:13:49 +01:00
|
|
|
const { configureApplication } = require('./app')
|
|
|
|
const { createAppLogger } = require('./log-utils')
|
2019-10-23 20:37:06 +02:00
|
|
|
const {
|
2019-10-24 10:21:41 +02:00
|
|
|
createRouteLogger,
|
|
|
|
createErrorLogger,
|
2019-10-23 20:37:06 +02:00
|
|
|
} = require('./middlewares')
|
2019-10-15 09:22:08 +02:00
|
|
|
|
2019-10-24 10:21:41 +02:00
|
|
|
const isDevelopment = process.env.NODE_ENV === 'development'
|
2020-11-15 15:13:49 +01:00
|
|
|
const port = process.env.PORT
|
2019-10-23 15:15:20 +02:00
|
|
|
|
2019-10-24 10:21:41 +02:00
|
|
|
const appLogger = createAppLogger({ dev: isDevelopment })
|
2020-11-15 15:13:49 +01:00
|
|
|
const errorLogger = createErrorLogger({ dev: isDevelopment })
|
|
|
|
const routeLogger = isDevelopment ? createRouteLogger({ dev: isDevelopment }) : null
|
|
|
|
|
|
|
|
const app = configureApplication({
|
|
|
|
appLogger,
|
|
|
|
errorLogger,
|
|
|
|
routeLogger,
|
|
|
|
rateLimitEnabled: true
|
2019-10-23 22:29:01 +02:00
|
|
|
})
|
|
|
|
|
2019-10-24 10:21:41 +02:00
|
|
|
app.listen(port)
|