Hello. Can anyone help me to understand why my project is not passing the tests?
My project is failing two of the tests but I can manually confirm it actually should pass every listed test.
1 - You can POST a URL to /api/shorturl and get a JSON response with original_url and short_url properties. Here’s an example: { original_url : 'https://freeCodeCamp.org', short_url : 1}
2 - When you visit /api/shorturl/<short_url> , you will be redirected to the original URL.
Hello. edper. I tryed with the short_url property as integer before but it doesn’t pass those two tests neither so I changed it into string as you see. Integer or String both get the same two tests to fail. Thanks the feedback
which is what gets logged in your GET route. This code looks like it may only work on repeated URLs and fail on new ones. You can use the automatically generated and added _id` field as your shortened URL.
Can’t check the validation without that file. It’s much easier to put this in a repl on repl.it and post a link.
I checked your code and it works 100% when I used my own regex. So, your code is good already except for your regex here. So, if you can find the regex that will work on this, you will be fine.
The challenge does not specifically require a number for a short url I believe. I used the nanoid package to generate mine. If anyone is reading this and curious about generating short urls.