diff --git a/routes/addon.js b/routes/addon.js index 1bba95a..007ac94 100644 --- a/routes/addon.js +++ b/routes/addon.js @@ -12,14 +12,6 @@ const { const {isAuthenticatedUser} = require('../middlewares/authenticate'); const {removeAllReleases} = require('../controller/release'); -// Gets the addon object by id -app.get("/:addonId", async (req, res) => { - const addon = await getAddonById(req.params.addonId); - if (addon === null) return res.status(404).json({message: "The provided addon does not exist"}); - - res.json(addon); -}); - // Gets a list of all addons by an author app.get("/:authorName/list", async (req, res) => { const addons = await listAddonsByAuthorName(req.params.authorName); @@ -44,6 +36,14 @@ app.get("/search", async (req, res) => { res.json(await searchAddon(req.query.query, req.query.limit || 25)); }); +// Gets the addon object by id +app.get("/:addonId", async (req, res) => { + const addon = await getAddonById(req.params.addonId); + if (addon === null) return res.status(404).json({message: "The provided addon does not exist"}); + + res.json(addon); +}); + // Creates a new addon app.put("/", isAuthenticatedUser, async (req, res) => { const validation = await validateSchema(create, req.body);