Skip to content

Commit

Permalink
Adds more robust routing; can now handle requests for :hex.png even i…
Browse files Browse the repository at this point in the history
…f .png doesn't exist.
  • Loading branch information
charliepark committed Aug 27, 2010
1 parent d16779f commit 8f24b59
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions colors.rb
@@ -1,11 +1,15 @@
require 'rubygems'
require 'chunky_png'
require 'sinatra'
require 'vendor/chunky_png/lib/chunky_png'
require 'vendor/sinatra/lib/sinatra'

get '/' do
redirect '/index.html'
end

get '/:hex.png' do
redirect '/'+params[:hex]
end

get '/:hex' do
hex = params[:hex].sub('.png','')
if hex.size == 3
Expand Down

0 comments on commit 8f24b59

Please sign in to comment.