Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(
config = {},
{ validator, router, events, models, controllers, services }
) {
super()
this.setupEmitter(events)
// Pluck keys out of `config.app` to keep them secret
const { keys, ...app } = config.app || {}
this.config = { ...config, app }
this.keys = keys
this.proxy = !!app.proxy
this.validator = validator || new Validator()
this.router = router || new Router()
this.validator.app = this
this.storages = Object.create(null)
this.models = Object.create(null)
this.services = Object.create(null)
this.controllers = Object.create(null)
this.hasControllerMiddleware = false
this.setupGlobalMiddleware()
this.setupKnex()
if (config.storages) {
this.addStorages(config.storages)
}
if (models) {
this.addModels(models)
}
if (services) {
this.addServices(services)