Hi all. I’m currently working on the back-end cert and have come to the url-shortening project. I’m having some difficulty getting my route to function properly. Basically, I am able to submit my post request to any endpoint I want, with the exception of something with double forward slashes (such as in http://www.stuff.com).
Currently my endpoint looks like this in express;
app.post('/new/:url(*)', (req,res) => {
let url = req.params.url;
if(validUrl.isWebUri(url)) {log('url is syntactically valid..');}
else log('url is syntactically invalid..');
res.send({
'url':url
})
res.end('response over');
})
I’ve also tried encoding the URL browser-side with encodeURIComponent, but that hasn’t helped. If someone can help me understand what I need to do to allow my requests to include double forward slashes, I would really appreciate it.
Here is my project: https://repl.it/@dayna_j/ConcernedSpiffyTriangles
(Sorry for the mess; ive been trying various things to fix this problem…)
Thanks!