Created
April 3, 2013 18:41
-
-
Save dmgarland/5303972 to your computer and use it in GitHub Desktop.
Bit.ly in a few lines...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
set :urls, { | |
:xyz => "http://www.generalassemb.ly" | |
} | |
get '/:short_url' do | |
full_url = settings.urls[params[:short_url].to_sym] | |
if full_url | |
redirect full_url | |
else | |
404 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment