-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
36 lines (28 loc) · 902 Bytes
/
Copy pathindex.js
File metadata and controls
36 lines (28 loc) · 902 Bytes
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
import { createServer } from 'http';
// import cluster from 'cluster';
// import { cpus } from 'os';
// import process from 'process';
import app from './src/api/v2/app.js';
import config from './src/config/config.js';
import db from './src/api/v2/helpers/db.js';
const httpServer = createServer(app);
// const numCPUs = cpus().length;
// if (cluster.isPrimary) {
// console.log(`Primary ${process.pid} is running`);
// // Fork workers.
// for (let i = 0; i < numCPUs; i++) {
// cluster.fork();
// }
// cluster.on('exit', (worker, code, signal) => {
// console.log(`worker ${worker.process.pid} died`);
// });
// } else {
const IP = /**process.env.IP || */ '127.0.0.1';
const PORT = config.port;
httpServer.listen(PORT, () => {
// Database configuration
db();
console.log(`Server running on ${IP}:${PORT}`);
});
// console.log(`Worker ${process.pid} started`);
// }