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

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

routerAdd("get", "/api/stats", (e) => {
    const heartbeat = $http.send({
        url: "https://db.174bg.net/api/heartbeat",
        headers: { "content-type": "application/json" }
    })

    return e.json(200, {
        heartbeat: heartbeat.json,
    })
})