nfp_sites/index.mjs

32 lines
880 B
JavaScript
Raw Normal View History

2022-04-05 16:47:24 +00:00
import config from './api/config.mjs'
2022-04-05 14:43:23 +00:00
export function start(http, port, ctx) {
2022-04-05 16:47:24 +00:00
config.stores.overrides.store = ctx.config
return import('./api/server.mjs')
2022-04-05 16:47:24 +00:00
.then(function(server) {
return server.run(http, port, ctx)
})
2022-04-05 14:43:23 +00:00
}
/*
2019-09-14 19:03:38 +00:00
import log from './api/log.mjs'
2019-02-19 11:34:52 +00:00
// Run the database script automatically.
2019-09-14 19:03:38 +00:00
import setup from './api/setup.mjs'
2019-02-19 11:34:52 +00:00
2019-09-13 13:33:10 +00:00
setup().catch(async (error) => {
log.error({ code: error.code, message: error.message }, 'Error while preparing database')
log.error('Unable to verify database integrity.')
log.warn('Continuing anyways')
// import('./api/config').then(module => {
// log.error(error, 'Error while preparing database')
// log.error({ config: module.default.get() }, 'config used')
// process.exit(1)
// })
}).then(() =>
2021-02-05 11:50:01 +00:00
import('./api/server.mjs')
2019-09-13 13:33:10 +00:00
).catch(error => {
log.error(error, 'Unknown error starting server')
2019-02-19 11:34:52 +00:00
})
2022-04-05 14:43:23 +00:00
*/