mirror of
https://github.com/dec0dOS/zero-ui.git
synced 2025-07-06 04:51:44 -07:00
refactor(backend/routes/network.js): better routes order
This commit is contained in:
parent
aea4a6a800
commit
de236b45a1
1 changed files with 11 additions and 11 deletions
|
@ -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
|
// create new network
|
||||||
router.post("/", auth.isAuthorized, async function (req, res) {
|
router.post("/", auth.isAuthorized, async function (req, res) {
|
||||||
let reqData = req.body;
|
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
|
// update network
|
||||||
router.post("/:nwid", auth.isAuthorized, async function (req, res) {
|
router.post("/:nwid", auth.isAuthorized, async function (req, res) {
|
||||||
const nwid = req.params.nwid;
|
const nwid = req.params.nwid;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue