Dynamic route path based on the variable - cookie

Hi, does anyone know how to code a dynamic route path based on the variable - cookie? I’d like to render my page by using “/pl” or “/en” path instead of “/:userLang” respectively. Any ideas?, please.

router.get("/", setUserLang, setCookieLang, controller.init);
router.get("/:userLang", controller.web)
router.post("/:userLang", controller.web)
exports.init = (req, res) => {
        const langFromCookie = req.cookies["user_lang"];
        res.status(302).redirect(`/${langFromCookie}`);
};

exports.web = async (req, res, next) => {
    const userLang = req.cookies.user_lang;
    ............
    res.render('index', { userLang });
};
type or paste code here