minecluster/lib/controllers/status-controller.js
2024-01-15 20:30:31 +00:00

18 lines
553 B
JavaScript

import { getDeployments } from "../k8s/k8s-server-control.js";
import { getInstances } from "../k8s/server-status.js";
import { sendError } from "../util/ExpressClientError.js";
export function serverList(req, res) {
getDeployments()
.then((sd) => res.json(sd.map((s) => s.metadata.name.substring(4))))
.catch((e) => {
ERR("STATUS CONTROLLER", e);
res.status(500).send("Couldn't get server list");
});
}
export function serverInstances(req, res) {
getInstances()
.then((i) => res.json(i))
.catch(sendError(res));
}