Spaces:
Paused
Paused
| 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}`); | |
| }); |