From 7dacde056c42c106dbdbfeee36304844f714f824 Mon Sep 17 00:00:00 2001 From: Samuel SIKATI KENMOGNE Date: Mon, 26 Aug 2024 15:22:44 +0000 Subject: [PATCH] refactor: simplify URL construction by removing fullUrl host part --- src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 11243b2..3a194f3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -63,7 +63,7 @@ const handleContributors = async (req: Request, res: Response) => { records = getRecordsMatchingQuery(query ?? "", records); const { count, items, interval } = paginate(records, parseInt(page ?? "1")); - const fullUrl = req.protocol + '://' + req.get('host') + req.originalUrl; + const fullUrl = req.originalUrl; res.render("index", { fullUrl, @@ -96,7 +96,7 @@ app.get("/shop", async (req, res) => { const query = req.query.query || ""; const page = req.query.page as string | undefined ; const { count, items, interval } = paginate(shopItems,parseInt(page ?? "1") || 1); - const fullUrl = req.protocol + '://' + req.get('host') + req.originalUrl; + const fullUrl = req.originalUrl; res.render("index", { fullUrl, @@ -113,7 +113,7 @@ app.get("/shop", async (req, res) => { }); app.get("/issues", async (req: Request, res: Response) => { - const fullUrl = req.protocol + '://' + req.get('host') + req.originalUrl; + const fullUrl = req.originalUrl; const issues: Issue[] = await getIssues(); const query = req.query.query || ""; const page = req.query.page as string | undefined ;