aboutsummaryrefslogtreecommitdiff
path: root/174bg/database/volumes/pocketbase/pb_hooks/stats.pb.js
blob: e2b6ab3f7dddb5f954bf3f56d8aa3a9ed6dc02fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
routerAdd("get", "/stats", (e) => {
    const heartbeat = $http.send({
        url: "https://db.174bg.net/api/heartbeat",
        headers: { "content-type": "application/json" }
    })

    return e.html(200, $template.loadFiles(
        `${__hooks}/views/_layout.html`,
        `${__hooks}/views/stats.html`,
    ).render({
        "timeDifference": heartbeat.json.timeDifference,
        "withinThreshold": heartbeat.json.withinThreshold,
    }))
})