[Solved] URL Shortener [Need Help] - My code is true but cant pass the test

My Project works fine and true but FCC doesn’t accept my code and I can’t pass the test. I don’t understand why?

My code so far

Your browser information:

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

Challenge: URL Shortener Microservice

Link to the challenge:

Hey, I just finished this challenge today. I had a go with yours and I get an error when I enter an invalid URL instead of the expected json response.

Thank you for review <3
Can you suggest a solution for my problem. Cause I really stuck here. I still working on it.
What could I be doing wrong ?

Hello there,

This is the user story:

You can POST a URL to /api/shorturl/new and get a JSON response with original_url and short_url properties. Here’s an example: { original_url : 'https://freeCodeCamp.org', short_url : 1}

This is what happens when I do that on your app:


Do you see the problem?

Hope this helps

Hey, I finally solved my problem, because you pointed me in right direction :smiley: All this time I was looking the wrong way :smiley:

I changed my shorturl function and I use the sha1 package in npm. Thank you <3