Back End Development and APIs Projects - URL Shortener Microservice

Tell us what’s happening:

My project is working fine on local host but when i provide the link to freecodecamp it says that it is not passing the test 2 and 3 but actually it works fine and gives a json response like {“original_url”:“https://example.com”,“short_url”:23} and it also redirects to the original link when I do /api/shorturl/23 on contrary freecodecamp test no. 2 and 3 fail

###Your project link(s)

solution: http://localhost:3000

githubLink: GitHub - sjd-1214/URL-Shortner-Microservice: freecodecamp backend web decelopment certification project

Your browser information:

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

Challenge Information:

Back End Development and APIs Projects - URL Shortener Microservice

Hello, are you saying that localhost is the problem or is it the Source Code Link ? The local host won’t work on any computer other than your own.

localhost

You need to use the cors package.

Require it in and apply the middleware using app.use().