Express route param breaks on params containing "@" -


have simple express route

router.get('/compare/:packages', function(req, res, next) {   const packages = req.params.packages.split(',');   res.render('index', { title: "title" }); }); 

when accessing contains @ sign, doesn't match , returns 404, help?

/compare/elm,@cycle/run 

edit: worked

router.get('/compare/:packages*', function(req, res, next) {   const packages = req.params.packages.split(',');   res.render('index', { title: "title" }); }); 

the issue isn't @, it's / before /run, because default, parameters delimited slashes.

you can use this:

router.get('/compare/*', function(req, res, next) {   const packages = req.params[0].split(',');   res.render('index', { title: "title" }); }); 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -