Back End Development and APIs Projects - URL Shortener Microservice

Tell us what’s happening:

Hi, I’m facing issues with URL validation in my project. Here are the cases I tested:
:white_check_mark: Valid:

:cross_mark: Invalid:
https://abc (missing domain suffix)
https:// (missing domain)
https: (incomplete URL)
http://www.example.com (Should invalid?)
Even when I set Pattern 6 to valid or invalid, tests fail. What exact cases are being checked?
https://shortcutservicevercel.vercel.app
GitHub - bdcuongvn83/short_cut_service_vercel
Mail:bdcuongvn83@gmail.com

###Your project link(s)

githubLink: GitHub - bdcuongvn83/short_cut_service_vercel

solution: https://shortcutservicevercel.vercel.app

Your browser information:

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

Challenge Information:

Back End Development and APIs Projects - URL Shortener Microservice

  • You can’t start the server, both in index and server. Export app from index and start it in server.

  • Add the cors package and use it.

  • Add a body parser and use it.

  • You can log req.body.url on the server to see the URLs. Or use the browser dev tools to look at the request/response when submitting.

  • Do not send a 400 status for the invalid URL response, it will cause the test to fail.

1 Like

@lasjorg Thank you for pointing out a few things that helped me identify the cause of the error. I was able to resolve it. Once again, thank you so much. Have a good day!