diff --git a/backend/routes/network.js b/backend/routes/network.js index fcc7175..6edef3a 100644 --- a/backend/routes/network.js +++ b/backend/routes/network.js @@ -22,6 +22,17 @@ router.get("/", auth.isAuthorized, async function (req, res) { }); }); +// get network +router.get("/:nwid", auth.isAuthorized, async function (req, res) { + const nwid = req.params.nwid; + const data = await network.getNetworksData([nwid]); + if (data[0]) { + res.send(data[0]); + } else { + res.status(404).send({ error: "Network not found" }); + } +}); + // create new network router.post("/", auth.isAuthorized, async function (req, res) { let reqData = req.body; @@ -42,17 +53,6 @@ router.post("/", auth.isAuthorized, async function (req, res) { }); }); -// get network -router.get("/:nwid", auth.isAuthorized, async function (req, res) { - const nwid = req.params.nwid; - const data = await network.getNetworksData([nwid]); - if (data[0]) { - res.send(data[0]); - } else { - res.status(404).send({ error: "Network not found" }); - } -}); - // update network router.post("/:nwid", auth.isAuthorized, async function (req, res) { const nwid = req.params.nwid;