Back End Development and APIs Projects - URL Shortener Microservice

My URL Shortener seems to work for me but doesn’t pass the tests.

Do you have any idea what could be the issue? Perhaps I’m not treating queries the right way?

githubLink: GitHub - dmgodoy/freecodecamp-project-urlshortener: A boilerplate for a freeCodeCamp project.
solution: freecodecamp-project-urlshortener - Replit

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36

Challenge: Back End Development and APIs Projects - URL Shortener Microservice

Link to the challenge:

Your urlValidator class does not work properly.

I submitted a valid url (see below) to your api and it responds with {"error":"invalid url"}

https://freecodecamp-project-urlshortener.rmdawson.repl.co

1 Like

Thanks a lot! That fixed the issue and I was able to pass the tests!

Cheers.

Hi Randell.

I think it was fine. Keep in mind I do url validation and after dns lookup. I believe that is the reason those URL fail.

Thanks again!!

Yes, I modified the regex. You can find the validator here:

https://replit.com/@damedina/freecodecamp-project-urlshortener#urlvalidator.js

It seems to work properly to me (see quick test below):

https://replit.com/@damedina/FreecodecampUrlValidatorTest#index.js

Cheers!

1 Like

Hi Randell.

Sorry, I don’t understand what your point is.

The provided urls fail the dns.lookup test, that’s why my app returns {“error”:“invalid url (dns lookup)”}.

Isn’t that the expected behavior?

Cheers!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.