URL Shortener Microservice - Tests not passing

I can’t find the issue with my URL Shortener Microservice:

One thing I noticed, though, is that when going to /api/shorturl/:short_url there seems to be an undefinded short_url.

My project: https://replit.com/@iCykres/url-shortener?v=1

Browser info: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Firefox/92.0

Challenge: URL Shortener Microservice

  1. The protocol property does not include the forward slashes //
console.log(new URL('https://www.google.com').protocol); // https:
  1. You have it so newUrl is always just the hostname and not the full URL.
let newUrl = originalUrl.hostname
console.log(new URL('https://www.google.com/test').hostname); // www.google.com
console.log(new URL('https://www.google.com/test').href); // https://www.google.com/test
1 Like

Thank you for your help!

For future visitors:

My first problem was the input to the DB: It is now:

new URL('https://www.google.com/test').href

For dns.lookup() I used new URL('https://www.google.com/test').hostname !

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