7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/httpme/server.rb', line 7
def setup(port: 3000, host: '0.0.0.0', path: '.', zone: 'Restricted Area', auth: nil)
reset!
set :bind, host
set :port, port
set :server, %w[puma webrick]
if auth
use Rack::Auth::Basic, zone do |username, password|
auth.split(':') == [username, password]
end
end
not_found do
content_type :text
'404 Not Found'
end
use Rack::TryStatic, root: path, urls: %w[/], try: %w[.html index.html /index.html]
self
end
|