I got a problem on my express server
app.get('/callback/:nation/:username/?:permalink', function(req, res)
{
nationurl = req.params.nation;
username = req.params.username;
storypermalink = req.params.permalink;
console.log("nation: "+nation);
console.log("username: "+username);
console.log("permalink: "+permalink);
});
Beacause of the /?: it split the username and doesn't give my permalink :
nation: poneyclub
username: j
permalink: hondoe
Anybody have an idea ?
This is because ?
is a special character in Express routing algorithm. See the documentation for details.
When you type URL Express treats everything after ?
character as a query. It should be in a format
?key1=value1&key2=value2&...&keyX=valueX
and it can be retrieved using req.query
.
You can change this default behaviour using your own regular expression in route (again see the documentation for details).