My first Golang web project is online

It is true: I fell in love with Go, not because I love Google and his products, but because it really fits my ideology of simplicity and power in a programming language. I started experimenting with the language and thank to his web-oriented approach I quickly came up with one of the simplest single task web application I could write: a URL shortener.

What is a URL shortener? It’s a service that will give you a short link for a long URL.

Why should I use it? A short URL is easier to remember and to copy and paste, it lets you write more on social media where characters are limited (Twitter).

Why writing one when there are plenty of them already? Other shortener have an expiration date on short links, 4pr.es doesn’t!

Take a look at the code and you’ll see it is very simple: it takes a URL as text input filed of a form

generates a random string of 6 charachters, checking that the string is not in the database

and keep the URL – string association in the database for further redirection; once the random short URL is visited the client gets redirected to the origianl long URL!

So please try it and if you have any suggestion to increase performance or security please let me know!

Cheers

 

 


See also

comments powered by Disqus