Back End Development and APIs Projects - URL Shortener Microservice

Tell us what’s happening:

Why i get undefined for the short url in the req.params for the third test case

When you visit /api/shorturl/<short_url> , you will be redirected to the original URL.

but if i test it by myself, it works

app.get("/api/shorturl/:short_url", async (req, res) => {
  console.log(req.params);
  const shortUrlParam = req.params.short_url;
  const isUrlFound = await Url.findOne({ shorturl: shortUrlParam });

  if (isUrlFound !== null) {
    res.redirect(isUrlFound.original_url);
  } else {
    res.status(404);
  }
});

###Your project link(s)

githubLink: GitHub - ArkanArsalan/URL-shortener-microservice

Your browser information:

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

Challenge Information:

Back End Development and APIs Projects - URL Shortener Microservice

Hello! Welcome to the community :slightly_smiling_face:!

The problem is that the test expects your API to return short_url instead of shorturl.

If you fix that, your test should pass :slight_smile:,

Happy coding!

I really appreciate your help. the test is pass. Happy coding to you too!