-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
49 lines (45 loc) · 1.65 KB
/
index.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
40
41
42
43
44
45
46
47
48
49
require("dotenv").config();
const express = require("express");
const app = express();
var app_instance = process.argv.NODE_APP_INSTANCE;
process.argv.NODE_APP_INSTANCE = "";
const config = require("config");
process.argv.NODE_APP_INSTANCE = app_instance;
//const pool = require("./startup/pgdb");
// const cluster = require("cluster");
// const totalCpus = require("os").cpus().length;
app.set("view engine", "pug");
app.set("views", "./views"); // to set default template
// if (cluster.isMaster) {
// console.log(`Total number of cpus Count is ${totalCpus}`);
// for (var i = 0; i < totalCpus; i++) {
// cluster.fork();
// }
// cluster.on("online", (worker) => {
// console.log(`Worker Id is ${worker.id} and PID is ${worker.process.pid}`);
// });
// cluster.on("exit", (worker) => {
// console.log(
// `Worker Id is ${worker.id} and PID is ${worker.process.pid} is offline`
// );
// console.log("Lets fork new worker");
// cluster.fork();
// });
// } else {
// require("./startup/logging")();
// require("./startup/routes")(app);
// require("./startup/db")();
// require("./startup/config")();
// require("./startup/validation")();
// require("./startup/prod")(app);
// const port = process.env.PORT || config.get("PORT");
// app.listen(port, () => console.log(`Listening on port ${port}...`));
// }
// require("./startup/logging")();
require("./startup/routes")(app);
// require("./startup/db")();
require("./startup/config")();
require("./startup/validation")();
require("./startup/prod")(app);
const port = process.env.PORT || config.get("PORT");
app.listen(port, () => console.log(`Listening on port ${port}...`));