Currently, I am facing an issue while setting a route in my application. I want the URL parameter to be exactly 2 characters long, but unfortunately, the following code snippet is not producing the desired result:
app.all('/:lng{2}?',function (req, res, next) {
// my code ...
});
It seems that the :lng parameter is not limited to exactly 2 characters and specifying {2} in the code does not seem to make any difference.
If anyone has a solution to this problem, I would greatly appreciate your assistance. Thank you.