mpp-server-dev2/index.js

37 lines
796 B
JavaScript
Raw Normal View History

2021-04-12 23:29:02 +02:00
// dotenv
2021-03-20 20:12:38 +01:00
require('dotenv').config();
2021-04-12 23:29:02 +02:00
// call new Server
2020-04-07 09:55:16 +02:00
global.WebSocket = require('ws');
global.EventEmitter = require('events').EventEmitter;
global.fs = require('fs');
2021-04-12 23:29:02 +02:00
const AsyncConsole = require('asyncconsole');
2020-04-07 09:55:16 +02:00
2021-04-12 23:29:02 +02:00
global.isString = function(a) {
2020-04-07 09:55:16 +02:00
return typeof a === 'string';
}
2021-04-12 23:29:02 +02:00
global.isBool = function(a) {
2020-04-07 09:55:16 +02:00
return typeof a === 'boolean';
}
2021-04-12 23:29:02 +02:00
global.isObj = function(a) {
2020-04-07 09:55:16 +02:00
return typeof a === "object" && !Array.isArray(a) && a !== null;
}
2020-04-07 23:02:35 +02:00
let Server = require("./src/Server.js");
2020-04-07 09:55:16 +02:00
let config = require('./config');
global.SERVER = new Server(config);
2021-04-12 23:29:02 +02:00
2022-05-24 21:40:09 +02:00
// doesn't work with pm2
2021-04-12 23:29:02 +02:00
/*
2020-04-07 09:55:16 +02:00
let console = process.platform == 'win32' ? new AsyncConsole("", input => {
try {
console.log(JSON.stringify(eval(input)));
} catch(e) {
console.log(e.toString());
}
}) : {};
2021-04-12 23:29:02 +02:00
*/