1
0
Fork 0

Use middleware Rack::Static

This commit is contained in:
Alex Kotov 2023-05-10 00:25:50 +04:00
parent 6a8e09db4e
commit 8408e342a6
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
2 changed files with 12 additions and 2 deletions

View File

@ -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

View File

@ -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