chore: Refactor v2 folder and class structure + Adding Company App (dummy)
This commit is contained in:
@@ -29,6 +29,8 @@ class ExpressJSServices {
|
||||
|
||||
async setup(){
|
||||
const app = this.app;
|
||||
|
||||
await AppsController.setup();
|
||||
|
||||
app.use( middlewares.Auth );
|
||||
|
||||
@@ -79,8 +81,10 @@ class ExpressJSServices {
|
||||
async init(){
|
||||
const app = this.app;
|
||||
|
||||
await AppsController.init();
|
||||
|
||||
app.use( middlewares.errorJSON );
|
||||
app.use( AppsController );
|
||||
app.use( AppsController.app_controller() );
|
||||
app.use( middlewares.error404 );
|
||||
|
||||
this.SystemServiceState = INIT;
|
||||
@@ -90,6 +94,8 @@ class ExpressJSServices {
|
||||
const app = this.app;
|
||||
const serverPort = this.serverPort;
|
||||
|
||||
await AppsController.connect();
|
||||
|
||||
const server = app.listen( serverPort , function(err){
|
||||
if( !err ){
|
||||
console.log('API listen on port', serverPort );
|
||||
@@ -104,12 +110,14 @@ class ExpressJSServices {
|
||||
}
|
||||
|
||||
async disconnect(){
|
||||
await AppsController.disconnect();
|
||||
this.server.close();
|
||||
|
||||
this.SystemServiceState = OFFLINE;
|
||||
}
|
||||
|
||||
async deinit(){
|
||||
await AppsController.deinit();
|
||||
this.SystemServiceState = UNINIT;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ const INIT = 1;
|
||||
const ONLINE = 2;
|
||||
const OFFLINE = 3;
|
||||
|
||||
class SystemServices {
|
||||
class SystemService {
|
||||
constructor(){
|
||||
this.SystemServiceState = UNINIT;
|
||||
}
|
||||
@@ -30,4 +30,4 @@ class SystemServices {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new SystemServices();
|
||||
module.exports = SystemService;
|
||||
Reference in New Issue
Block a user