Hello,
I just finished the URL Shortner project and it was quite a challenge. I’ll be happy to know if you have any comments or feedbacks on it.
Good job, I I had a look at the code to see how you build a “smart code” for the url and I’ve discovered “shortid”, thank you for that but I haven’t seen how you check if the new shortid is already into the db
Thank you for your feedback @NeckersBOX. I did some research before choosing a way to generate a unique id for each url. one obvious way would have been a function that increments numbers from a certain integer, but it wouldn’t be cool enough. So I searched more and found the amazing
shortid
library that generates random and “unique” IDs. The algorithm apparantly some how generates unique ids as long as it always runs on the same machine. You can check It’s documentation for more information.
Of course under some other circumstances I would have somehow checked if once in a blue moon the generated id isn’t unique, but for the purpose of this project, the generated ids are good enough.
Source Code: https://github.com/fntgnn/FCC_URL_Shortener
App Link: https://fntgnn-fcc-url-shortener.herokuapp.com/