We’re thinking about creating a URL shortener service to make it easier to share Grasswire links across the web. Here’s a rough proof-of-concept that implements the basic functionality in 45 lines of code:
To create a short link, we generate a random String and use Redis to store the original url with our random String as the key. When a GET request is issued to the shortened url, we retrieve the original url from Redis. If such a value exists, we redirect, otherwise we respond with a Not Found status.
— Levi Notik, CTO/Co-founder at Grasswire