pluviouse commited on
Commit
4d1f385
·
verified ·
1 Parent(s): 4ddb36d

Create app.js

Browse files
Files changed (1) hide show
  1. app.js +20 -0
app.js ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const express = require('express');
2
+ const app = express();
3
+
4
+ // Inisialisasi penghitung hit
5
+ let hitCount = 0;
6
+
7
+ // Route untuk menghitung hit
8
+ app.get('/', (req, res) => {
9
+ hitCount++;
10
+ res.json({
11
+ message: 'Selamat datang di penghitung hit!',
12
+ hits: hitCount
13
+ });
14
+ });
15
+
16
+ // Mendengarkan di port 7680
17
+ const PORT = 7680;
18
+ app.listen(PORT, () => {
19
+ console.log(`Server berjalan di port ${PORT}`);
20
+ });