ilhamdev commited on
Commit
7f1a662
·
verified ·
1 Parent(s): a4bfcfd

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +25 -25
index.js CHANGED
@@ -511,37 +511,37 @@ const app = express()
511
  .use(morgan('dev'))
512
  .use(express.json())
513
  .all('/', async (req, res) => {
514
- const v8 = require('v8')
515
- const status = {}
516
- status['diskUsage'] = cp.execSync('du -sh').toString().split('M')[0] + ' MB'
517
 
518
- const used = process.memoryUsage()
519
- for (let x in used) status[x] = formatSize(used[x])
520
 
521
- const totalmem = os.totalmem()
522
- const freemem = os.freemem()
523
- status['memoryUsage'] = `${formatSize(totalmem - freemem)} / ${formatSize(totalmem)}`
524
 
525
- // Menambahkan statistik heap V8
526
- const heapStats = v8.getHeapStatistics();
527
- for (let x in heapStats) status[x] = formatSize(heapStats[x])
528
 
529
- // Menambahkan semua properti dan metode dari v8
530
- for (let x in v8) {
531
- if (typeof v8[x] !== 'function') {
532
- status[x] = v8[x]
533
- }
534
- }
535
- })
536
 
537
- const host = 'https://' + req.get('host');
 
 
 
 
 
 
 
538
 
539
- res.json({
540
- creator: `@${process.env['SPACE_AUTHOR_NAME'] || 'ALOK FF'}`,
541
- message: 'Hello World!',
542
- uptime: new Date(process.uptime() * 1000).toUTCString().split(' ')[4],
543
- status, // Menambahkan latency ke JSON
544
- list: [
545
  {
546
  title: "BING AI",
547
  method: "GET",
 
511
  .use(morgan('dev'))
512
  .use(express.json())
513
  .all('/', async (req, res) => {
514
+ const v8 = require('v8'); // Menempatkan ini di dalam handler agar tidak dijalankan saat server dimulai
 
 
515
 
516
+ const status = {};
517
+ status['diskUsage'] = cp.execSync('du -sh').toString().split('M')[0] + ' MB';
518
 
519
+ const used = process.memoryUsage();
520
+ for (let x in used) status[x] = formatSize(used[x]);
 
521
 
522
+ const totalmem = os.totalmem();
523
+ const freemem = os.freemem();
524
+ status['memoryUsage'] = `${formatSize(totalmem - freemem)} / ${formatSize(totalmem)}`;
525
 
526
+ // Menambahkan statistik heap V8
527
+ const heapStats = v8.getHeapStatistics();
528
+ for (let x in heapStats) status[x] = formatSize(heapStats[x]);
 
 
 
 
529
 
530
+ // Menambahkan semua properti dan metode dari v8
531
+ for (let x in v8) {
532
+ if (typeof v8[x] !== 'function') {
533
+ status[x] = v8[x];
534
+ }
535
+ }
536
+
537
+ const host = 'https://' + req.get('host');
538
 
539
+ res.json({
540
+ creator: `@${process.env['SPACE_AUTHOR_NAME'] || 'ALOK FF'}`,
541
+ message: 'Hello World!',
542
+ uptime: new Date(process.uptime() * 1000).toUTCString().split(' ')[4],
543
+ status, // Menambahkan latency ke JSON
544
+ list: [
545
  {
546
  title: "BING AI",
547
  method: "GET",