Back End Development and APIs Projects - URL Shortener Microservice

Hi,
I am currently trying to achieve the challenge "Back End Development and APIs - URL Shortener Microservice’.
I did the following project deployed thanks to Replit (below).
From my point of view, it corresponds to what is asked but the correction says item 2 and 3 are wrong.
Please, could you tell me how you understand this.

Regards

Your project link(s)

solution: https://replit.com/@octdes/microservice1a-2

Your browser information:

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

Challenge: URL Shortener Microservice

Link to the challenge:

Hello there,

Opening the network tab shows:

Your app’s response:

Why is that an invalid url?

Hope this helps

I think you have an old version or you changed the HTML. Try logging out req.body and the regex inside the /api/shorturl route.

console.log('req.body', req.body)
console.log('req.body.name', req.body.name)
console.log(httpRegex.test(req.body.name))

The name attribute on the input element should be name="url". Check the boilerplate or restart using the current replit starter.

The redirect seems to be getting blocked when I submit. Try using the cors package instead.

Thank you lasjorg,
I have used the template with this link : “https://replit.com/github/freeCodeCamp/boilerplate-project-urlshortener” and copy paste my code with some modifications inside and it works…
Maybe “const cors = require(‘cors’);” was missing or something else, I don’t know. Any case, thank you very much for you quick reply !
Regards

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