Use middleware Rack::Static
This commit is contained in:
parent
6a8e09db4e
commit
8408e342a6
2 changed files with 12 additions and 2 deletions
|
@ -21,8 +21,18 @@ module Diversipub
|
||||||
|
|
||||||
def builder
|
def builder
|
||||||
@builder ||= Rack::Builder.new.tap do |builder|
|
@builder ||= Rack::Builder.new.tap do |builder|
|
||||||
|
builder.use Rack::Static, **rack_static_kwargs
|
||||||
builder.run @sinatra_app
|
builder.run @sinatra_app
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def rack_static_kwargs
|
||||||
|
@rack_static_kwargs ||= {
|
||||||
|
cascade: true,
|
||||||
|
index: 'index.html',
|
||||||
|
root: File.expand_path('../website/build').freeze,
|
||||||
|
urls: [''].freeze,
|
||||||
|
}.freeze
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,8 +20,8 @@ module Diversipub
|
||||||
alias new new!
|
alias new new!
|
||||||
end
|
end
|
||||||
|
|
||||||
get '/' do
|
get '/index.html' do
|
||||||
'Hello, World!'
|
redirect 'ru/index.html'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue