DEV Community

Discussion on: A URL Shortener Service using Go, Iris and Bolt

Collapse
rhymes profile image
rhymes • Edited on

To create a short link, we generate a random string and use Bolt to store the original URL with our random string as the key

shouldn't the short link be some sort of hash of the URL?

Collapse
kataras profile image
Gerasimos (Makis) Maropoulos Author • Edited on

You are right, however, this tutorial was for the very beginners. Devs with experience can change the algorithm with ease, it lives in a single spot in the source code. Hashing wouldn't allow to push duplicates as well, the method we use here is by giving an UUID to the link, so the link can be after linked to a database per user for example. The article was mostly written to learn how you can link a database with the logic and the actual routes by creating something all of us know, url short links. However, I am 100% open to continue by uploading a new post (when I finish the new release of Iris) which will describe more advanced features, not only hashing as tring (which is easy enough with Go) if you wanna so. Thank you for your feedback @rhymes !

Collapse
rhymes profile image
rhymes

I think it's fine, thanks! :)

Thread Thread
kataras profile image
Gerasimos (Makis) Maropoulos Author • Edited on

You're welcome. You already gave me a push for writing more articles, including hashing, request authentication/verification and etc, make sure you follow me up :)