Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

17 lines (13 sloc) 0.415 kB
require 'sinatra'
require 'sequel'
DB = Sequel.connect(ENV['DATABASE_URL'] || 'sqlite://b.db')
get '/:key' do
if DB[:links].where(:key => params[:key]).first
redirect to("http://#{ENV['DESTINATION_ROOT']}" + DB[:links].where(:key => params[:key]).first[:destination])
else
redirect to("http://#{ENV['DESTINATION_ROOT']}")
end
end
get '/' do
redirect to("http://#{ENV['DESTINATION_ROOT']}")
end
Jump to Line
Something went wrong with that request. Please try again.