nfp_sites/nfp_is/index.mjs
Jonatan Nilsson 972dde2c74
All checks were successful
/ nfp_moe (push) Successful in -83h47m27s
continuous-integration/appveyor/branch AppVeyor build succeeded
/ saproxy (push) Successful in -83h47m29s
/ discord_embed (push) Successful in -83h47m28s
/ nfp_is (push) Successful in -83h46m7s
nfp_is: moved nfpis over here
2023-11-05 05:38:10 +00:00

38 lines
835 B
JavaScript

import fs from 'fs'
import { pathToFileURL } from 'url'
import config from './base/config.mjs'
export function start(http, port, ctx) {
config.sources[1].store = ctx.config
return import('./api/server.mjs')
.then(function(module) {
let server = new module.default(http, port, ctx)
return server.run()
})
}
if (import.meta.url === pathToFileURL(process.argv[1]).href) {
import('service-core').then(core => {
const port = 4210
var core = new core.ServiceCore('nfp_is', import.meta.url, port, '')
let config = {
frontend: {
url: 'http://localhost:' + port
}
}
try {
config = JSON.parse(fs.readFileSync('./config.json'))
} catch {}
config.port = port
core.setConfig(config)
core.init({ start }).then(function() {
return core.run()
})
})
}