#!/bin/node const path = require('path'); const fs = require('fs'); const Router = require('node-simple-router'); const http = require('http'); const CONFIG = require('./src/config.js'); const RouterUtils = require('./src/routerUtils.js').RouterUtils; function App() { this.router = new Router({ static_route: __dirname+"/static/" }); const _app = this; this.routerUtils = new RouterUtils(this); this.databaseHelper = require('./src/databaseHelper.js').DatabaseHelper; } App.prototype.init = async function() { const _app = this; require('./router/mdi.js').register(this); await this.databaseHelper.init(); } App.prototype.clock = function() { setTimeout(() => this.clock(), 10 *60 *1000); // 10 minutes } App.prototype.run = function() { this.clock(); http.createServer(this.router).listen(CONFIG.port); } let app = new App(); app.init().then(() => app.run());