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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -