@wbg-mde/server
Version:
MDE communication channel with Socket IO and express.
30 lines • 956 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const app_1 = require("./app");
const main_socket_1 = require("./socket/main.socket");
class Server {
constructor(opt) {
this.PORT = 4646;
this.options = opt;
}
/*
* Start the application
**********************************************/
start() {
const http = require('http').Server(app_1.default);
// #. Set port
this.PORT = this.options ? (this.options.port || this.PORT) : this.PORT;
// #. Init the main socket listner
this.mainSocket = new main_socket_1.MainSocket();
this.mainSocket.init(http);
// #. Start the server
http.listen(this.PORT, () => {
console.log('listening on *:' + this.PORT);
});
}
}
exports.Server = Server;
if (process.env.NODE_ENV === 'dev') {
new Server();
}
//# sourceMappingURL=server.js.map