From a8269e9057f3e5f5ffbf6c8a130ba9790148adb4 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Wed, 1 Jan 2025 22:06:44 +0100 Subject: [PATCH] fix: fix the bug with "path.replace" not being a function when adding middleware for Express router --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 06b2fbd..2a948ca 100644 --- a/src/index.js +++ b/src/index.js @@ -99,7 +99,7 @@ function svrouter() { } else if (middleware && typeof path !== "string") { throw new Error("The path must be a string."); } - const realPath = realMiddleware ? path.replace(/\/+$/, "") : ""; + const realPath = middleware ? path.replace(/\/+$/, "") : ""; const callback = (req, res, logFacilities, config, next) => { const previousReqBaseUrl = req.baseUrl;