small controller to deliver images
This is nice for development, but should not be used in production. Most webservers can do better.
This commit is contained in:
parent
5b54051db6
commit
fcb995b0f0
|
@ -0,0 +1,11 @@
|
|||
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
|
Loading…
Reference in New Issue