fcb995b0f0
This is nice for development, but should not be used in production. Most webservers can do better.
12 lines
297 B
Ruby
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
|