File size: 418 Bytes
4d1f385
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const express = require('express');
const app = express();

// Inisialisasi penghitung hit
let hitCount = 0;

// Route untuk menghitung hit
app.get('/', (req, res) => {
    hitCount++;
    res.json({
        message: 'Selamat datang di penghitung hit!',
        hits: hitCount
    });
});

// Mendengarkan di port 7680
const PORT = 7680;
app.listen(PORT, () => {
    console.log(`Server berjalan di port ${PORT}`);
});