From 74bc24da559feb0dedcd04726bea45ea7cb847dc Mon Sep 17 00:00:00 2001 From: BurnyLlama Date: Sat, 6 Nov 2021 15:42:11 +0100 Subject: [PATCH] Fixed issue with order of loading shit... --- index.js | 2 +- routes/routes.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index d551f09..6d5db54 100644 --- a/index.js +++ b/index.js @@ -21,13 +21,13 @@ const log = initLog("[ MAIN ]") // Read the .env file dotenv.config() -dbInit() setStat("startup", start) setStat("lastDBUpdate", start) if (process.env.DOWNLOAD_FILES === "enabled") await downloadEssentialData() +dbInit() generateDB() const Server = express() diff --git a/routes/routes.js b/routes/routes.js index 86a67fd..069bfd2 100644 --- a/routes/routes.js +++ b/routes/routes.js @@ -12,6 +12,21 @@ routes.get( } ) +routes.get( + '/search', + (req, res) => { + const map = req.query.qmap ?? "" + const categories = req.query.categories ?? [] + const stars = req.query.stars ?? [] + const sort = req.query.sortBy ?? "map" + const order = req.query.order === "desc" ? "desc" : "asc" + + const maps = wrapper.searchMap(map, categories.split(","), stars.split(","), sort, order) + + tx(req, res)('pages/maps.njk', { maps }, true, { currentSection: "maps" }) + } +) + routes.get( '/maps', (req, res) => {