From 9f5e17519d65a3af6a4a89290429dcce2e35676e Mon Sep 17 00:00:00 2001 From: juancarmore Date: Mon, 24 Feb 2025 15:03:05 +0100 Subject: [PATCH] Refactor egress controller in Node.js API to improve variable naming and update endpoint path to add/remove stream URLs to an egress --- ...lication-server-tutorials.postman_collection.json | 4 ++-- .../node/src/controllers/egress.controller.js | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/application-server/application-server-tutorials.postman_collection.json b/application-server/application-server-tutorials.postman_collection.json index c4a3a533..39fb0fa2 100644 --- a/application-server/application-server-tutorials.postman_collection.json +++ b/application-server/application-server-tutorials.postman_collection.json @@ -538,13 +538,13 @@ } }, "url": { - "raw": "{{EGRESS_URL}}/{{EGRESS_ID}}/stream", + "raw": "{{EGRESS_URL}}/{{EGRESS_ID}}/streams", "host": [ "{{EGRESS_URL}}" ], "path": [ "{{EGRESS_ID}}", - "stream" + "streams" ] } }, diff --git a/application-server/node/src/controllers/egress.controller.js b/application-server/node/src/controllers/egress.controller.js index 39ff4bb5..1690fa90 100644 --- a/application-server/node/src/controllers/egress.controller.js +++ b/application-server/node/src/controllers/egress.controller.js @@ -203,8 +203,8 @@ egressController.post("/:egressId/layout", async (req, res) => { } try { - const egressInfo = await egressClient.updateLayout(egressId, layout); - res.json({ egressInfo }); + const egress = await egressClient.updateLayout(egressId, layout); + res.json({ egress }); } catch (error) { const errorMessage = "Error updating egress layout"; console.error(errorMessage, error); @@ -213,7 +213,7 @@ egressController.post("/:egressId/layout", async (req, res) => { }); // Add/remove stream URLs to an egress -egressController.post("/:egressId/stream", async (req, res) => { +egressController.post("/:egressId/streams", async (req, res) => { const { egressId } = req.params; const { streamUrlsToAdd, streamUrlsToRemove } = req.body; @@ -223,8 +223,8 @@ egressController.post("/:egressId/stream", async (req, res) => { } try { - const egressInfo = await egressClient.updateStream(egressId, streamUrlsToAdd, streamUrlsToRemove); - res.json({ egressInfo }); + const egress = await egressClient.updateStream(egressId, streamUrlsToAdd, streamUrlsToRemove); + res.json({ egress }); } catch (error) { const errorMessage = "Error updating egress streams"; console.error(errorMessage, error); @@ -237,7 +237,7 @@ egressController.delete("/:egressId", async (req, res) => { const { egressId } = req.params; try { - const egressInfo = await egressClient.stopEgress(egressId); + await egressClient.stopEgress(egressId); res.json({ message: "Egress stopped" }); } catch (error) { const errorMessage = "Error stopping egress";