Back End Development and APIs Projects - URL Shortener Microservice

this are my code i don’t know if it’s my replit bothering i don’t know what to do right know

const originalUrls = [];
const shortUrls = [];

app.post("/api/shorturl/new", (req, res) => {
  const url = req.body.url
  const foundIndex = originalUrls.indexOf(url);
  console.log("bonjour", url);
  if (!url.includes("https://") && !url.includes("http://")) {
    return res.json({ error: "Invalid url" })
  }

  if (foundIndex < 0) {
    originalUrls.push(url)
    shortUrls.push(shortUrls.length)

    return res.json({
      original_url: url,
      short_url: shortUrls.length - 0
    });
  };

  return res.json({
    original_url: url,
    short_url: shortUrls[foundIndex]
  });
});

app.get("/api/shorturl/:shorturl", (req, res) => {
  const shorturl = parseInt(req.params.shorturl)
  const foundIndex = shortUrls.indexOf(shorturl);

  if (foundIndex < 0) {
    return res.json({
      "error": "No short URL found for the given input"
    });
  }
  res.redirect(originalUrls[foundIndex])
});

here is the link

https://replit.com/@bowak/boilerplate-project-urlshortener-2#index.js

type or paste code here

First of all, where in the project instructions does it tell you the POST route should be /api/shorturl/new?

The answer is nowhere. The POST route should be /api/shorturl

You have several other problems with your code once you resolve this first issue. You should be able to look at the error messages generated in the Node console for further instruction.