0
0
zero-blog/controller/image.rb
Gibheer fcb995b0f0 small controller to deliver images
This is nice for development, but should not be used in production. Most
webservers can do better.
2013-10-27 19:46:16 +01:00

12 lines
297 B
Ruby

module Routes
class Images
def self.call(session)
file = "images/#{session.request.path.gsub(/images/, '')}"
return RouteNotFound unless File.exist?(file)
session.response.body = File.read(file)
session.response.content_type = 'image/png'
nil
end
end
end