Add status endpoint
This commit is contained in:
parent
a218e2a674
commit
d316728c52
1 changed files with 7 additions and 0 deletions
|
|
@ -144,6 +144,7 @@ export class Main {
|
||||||
|
|
||||||
private readonly ipv4: IP2Location
|
private readonly ipv4: IP2Location
|
||||||
private readonly ipv6: IP2Location
|
private readonly ipv6: IP2Location
|
||||||
|
private readonly boottime = new Date()
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
console.log("Loading databases from ./data/")
|
console.log("Loading databases from ./data/")
|
||||||
|
|
@ -164,6 +165,12 @@ export class Main {
|
||||||
handle: async (path, params, request) => {
|
handle: async (path, params, request) => {
|
||||||
return JSON.stringify(this.fetchIp(request))
|
return JSON.stringify(this.fetchIp(request))
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
mustMatch: "status",
|
||||||
|
mimetype: "application/json",
|
||||||
|
handle: async () => {
|
||||||
|
return JSON.stringify({online: true, started: this.boottime.toISOString()})
|
||||||
|
}
|
||||||
}])
|
}])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue