lib: Add optional port parameter that is prefilled. Prevents crashes if no port is specified
continuous-integration/appveyor/branch AppVeyor build failed Details

package: Increment beta version
master
Jonatan Nilsson 2022-03-10 13:38:35 +00:00
parent 1f70f36e8d
commit 1d7b118229
2 changed files with 6 additions and 2 deletions

View File

@ -6,7 +6,7 @@ import StaticProvider from './providers/static.mjs'
import Core from './core.mjs'
export default class ServiceCore {
constructor(name, root_import_meta_url, dbfilename = 'db.json') {
constructor(name, root_import_meta_url, port = 4000, dbfilename = 'db.json') {
if (!root_import_meta_url) {
throw new Error('ServiceCore must be called with the full string from "import.meta.url" from a file residing in the root directory')
}
@ -19,6 +19,10 @@ export default class ServiceCore {
this.db = null
this.core = null
this.app = null
this.setConfig({
port: port,
})
}
setConfig(config) {

View File

@ -1,6 +1,6 @@
{
"name": "service-core",
"version": "3.0.0-beta.7",
"version": "3.0.0-beta.8",
"description": "Core boiler plate code to install node server as windows service",
"main": "index.mjs",
"scripts": {