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
|
||||
@builder ||= Rack::Builder.new.tap do |builder|
|
||||
builder.use Rack::Static, **rack_static_kwargs
|
||||
builder.run @sinatra_app
|
||||
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
|
||||
|
|
|
@ -20,8 +20,8 @@ module Diversipub
|
|||
alias new new!
|
||||
end
|
||||
|
||||
get '/' do
|
||||
'Hello, World!'
|
||||
get '/index.html' do
|
||||
redirect 'ru/index.html'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue