Spaces:
Running
Running
Update app.js
Browse files
app.js
CHANGED
@@ -13,7 +13,7 @@ app.get('/', (req, res) => {
|
|
13 |
const userAgent = req.headers['user-agent'];
|
14 |
|
15 |
// Increment hit only if not from fetch
|
16 |
-
if (!userAgent || userAgent
|
17 |
hitCount++;
|
18 |
}
|
19 |
|
@@ -21,7 +21,7 @@ app.get('/', (req, res) => {
|
|
21 |
message: 'Welcome to the hit counter!',
|
22 |
hits: hitCount,
|
23 |
userAgent: userAgent,
|
24 |
-
counted:
|
25 |
});
|
26 |
});
|
27 |
|
|
|
13 |
const userAgent = req.headers['user-agent'];
|
14 |
|
15 |
// Increment hit only if not from fetch
|
16 |
+
if (!userAgent || userAgent?.toLowerCase().includes('fetch')) {
|
17 |
hitCount++;
|
18 |
}
|
19 |
|
|
|
21 |
message: 'Welcome to the hit counter!',
|
22 |
hits: hitCount,
|
23 |
userAgent: userAgent,
|
24 |
+
counted: userAgent?.toLowerCase().includes('fetch')
|
25 |
});
|
26 |
});
|
27 |
|