After a very frustrating start, I have code that works when I test it on my browser, but will not pass the second or third test. I have not addressed the issue with a unique shortUrl for each record yet, but I can fix that later. I’m wondering if someone can point me in the right direction for getting my functioning code to pass the first three tests!
Access to fetch at 'https://boilerplate-project-urlshortener-2.carolmurphy.repl.co/api/shorturl' from origin 'https://www.freecodecamp.org' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
You need to tell CORS to let other hosts have access here:
app.use(cors());
Your verification stuff won’t work either looking for www or http://www in valid URLs as the tests will use https://boilerplate-project-urlshortener-2.carolmurphy.repl.co/ plus some parameters to test which is valid and does not contain www or http://www.
Thanks, jeremy. I woulda swore I had that in there. I think I’ll switch to validation for my url verification method instead of dns. once I get things more squared away. This process has been a steep learning slope for me. Once I get down a rabbithole, I get so confused I just start throwing code into the mix and it gets so muddled I do better scrapping it and starting over from scratch! I think I’m close to having a working solution that I will actually understand pretty well.