I'm trying to capture an optional :lang?
param of two charachters for this routes:
/ // lang: undefined
/en // lang: en
/projects // lang: undefined
/en/projects // lang: en
This is my try:
router.get('/:lang([a-z]{2})?*', function(req, res, next) {
}
But for /projects
it sets a :lang?
parameter as pr
.
How can I avoid that?