Moved the route under the search route
This commit is contained in:
parent
841cab36da
commit
f9cb2cbed1
@ -12,14 +12,6 @@ const {
|
|||||||
const {isAuthenticatedUser} = require('../middlewares/authenticate');
|
const {isAuthenticatedUser} = require('../middlewares/authenticate');
|
||||||
const {removeAllReleases} = require('../controller/release');
|
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
|
// Gets a list of all addons by an author
|
||||||
app.get("/:authorName/list", async (req, res) => {
|
app.get("/:authorName/list", async (req, res) => {
|
||||||
const addons = await listAddonsByAuthorName(req.params.authorName);
|
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));
|
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
|
// Creates a new addon
|
||||||
app.put("/", isAuthenticatedUser, async (req, res) => {
|
app.put("/", isAuthenticatedUser, async (req, res) => {
|
||||||
const validation = await validateSchema(create, req.body);
|
const validation = await validateSchema(create, req.body);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user