-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
40 lines (37 loc) · 983 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
***
Pekmez Simple Web Server Main Application
***
*/
var pekmez = require("./server");
var settings = require('./config/settings.js');
var cluster = require('cluster');
const chalk = require('chalk');
const log = console.log;
const fs = require('fs');
try {
if (fs.existsSync("./config/settings.js")) {
if(settings){
if(settings.cluster){
if (cluster.isMaster) {
var cpuCount = require('os').cpus().length;
for (var i = 0; i < cpuCount; i += 1) {
cluster.fork();
}
}else{
pekmez.init();
pekmez.start();
}
}else{
pekmez.init();
pekmez.start();
}
}else{
log(chalk.red("Wrong Js File!"));
}
}else{
log(chalk.red("Settings Js File Not Found!"));
}
} catch(err) {
log(chalk.red(err));
}