Added new endpoint for getting Orch info

This commit is contained in:
Marco van Dijk 2022-03-03 11:56:59 +01:00
parent 0f15927376
commit 2c3b493349

View File

@ -311,13 +311,26 @@ const parseOrchestrator = async function (reqAddr) {
orchestratorCache.push(orchestratorObj); orchestratorCache.push(orchestratorObj);
} }
} }
console.log(orchestratorObj);
return orchestratorObj; return orchestratorObj;
} }
apiRouter.get("/getOrchestrator", async (req, res) => { apiRouter.get("/getOrchestrator", async (req, res) => {
try { try {
const reqObj = await parseOrchestrator(defaultOrch); let reqOrch = req.query.orch;
if (!reqOrch || reqOrch == ""){
reqOrch = defaultOrch;
}
const reqObj = await parseOrchestrator(reqOrch);
res.send(reqObj);
} catch (err) {
console.log(err);
res.status(400).send(err);
}
});
apiRouter.get("/getOrchestrator/:orch", async (req, res) => {
try {
const reqObj = await parseOrchestrator(req.params.orch);
res.send(reqObj); res.send(reqObj);
} catch (err) { } catch (err) {
console.log(err); console.log(err);