Skip to content

Commit 3e20be2

Browse files
committed
Show live requests-served counter on the landing page and README
1 parent d4737e2 commit 3e20be2

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

site/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ <h1>Ship with every Algerian courier through <em>one</em> API</h1>
227227
<a class="btn" href="https://github.com/DZBuild-com/dzship" rel="noopener">Courier guides →</a>
228228
</div>
229229
<div class="hero-meta">
230+
<span id="reqStat" hidden><b id="reqStatN">0</b> requests served</span>
230231
<span><b>POST</b> /v1/orders</span>
231232
<span><b>POST</b> /v1/track</span>
232233
<span><b>POST</b> /v1/rates</span>
@@ -529,5 +530,17 @@ <h2 style="margin-top:8px">dzship is the shipping. DZBuild is the rest.</h2>
529530
}
530531
})();
531532
</script>
533+
<script>
534+
(function () {
535+
var el = document.getElementById('reqStat'), n = document.getElementById('reqStatN');
536+
if (!el || !n || !window.fetch) return;
537+
fetch('/stats').then(function (r) { return r.json(); }).then(function (d) {
538+
if (d && typeof d.totalRequests === 'number' && d.totalRequests > 0) {
539+
n.textContent = d.totalRequests.toLocaleString('en-US');
540+
el.hidden = false;
541+
}
542+
}).catch(function () {});
543+
})();
544+
</script>
532545
</body>
533546
</html>

0 commit comments

Comments
 (0)