Problem with express route (url-shortener project)

Problem with express route (url-shortener project)


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

Currently my endpoint looks like this in express;'/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.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:
(Sorry for the mess; ive been trying various things to fix this problem…)



I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.