minecluster/lib/controllers/status-controller.js

19 lines
583 B
JavaScript
Raw Normal View History

import { getUserDeployments } from "../k8s/k8s-server-control.js";
import { getInstances } from "../k8s/server-status.js";
import { sendError } from "../util/ExpressClientError.js";
export function serverList(req, res) {
getUserDeployments(req.cairoId)
.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(req.cairoId)
.then((i) => res.json(i))
.catch(sendError(res));
}