Add status endpoint

This commit is contained in:
Pieter Vander Vennet 2024-06-17 18:28:49 +02:00
parent a218e2a674
commit d316728c52

View file

@ -144,6 +144,7 @@ export class Main {
private readonly ipv4: IP2Location
private readonly ipv6: IP2Location
private readonly boottime = new Date()
constructor() {
console.log("Loading databases from ./data/")
@ -164,6 +165,12 @@ export class Main {
handle: async (path, params, request) => {
return JSON.stringify(this.fetchIp(request))
}
}, {
mustMatch: "status",
mimetype: "application/json",
handle: async () => {
return JSON.stringify({online: true, started: this.boottime.toISOString()})
}
}])
}