Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function getConfiguredContainer () {
const container = createContainer()
// register the values
container.register({ db: asValue(db) })
container.register({ environment: asValue(environment) })
container.register({ packagejson: asValue(packagejson) })
const models = listModules('../app/models/*.js', { cwd: __dirname })
models.forEach(
(m) => {
const target = require(m.path).default
const name = m.name[0].toUpperCase() + m.name.slice(1)
if (target.init) {
container.register({ [name]: asFunction(target.init.bind(target)).singleton() })
} else {
container.register({ name, target })
}
}
)
container.loadModules([
'../app/services/*.js'
], {
export default function createApis (router, container) {
const result = listModules('../app/apis/v1/*.js', { cwd: __dirname })
result.forEach(
m => require(m.path).default(router, container)
)
}
export default function createApis (router) {
const result = listModules('../api/*.js', { cwd: __dirname })
result.forEach(
m => require(m.path).default(router)
)
}