Skip to content

Instantly share code, notes, and snippets.

@adamluzsi
Created May 4, 2016 11:01
Show Gist options
  • Save adamluzsi/2f506ee18a3d9c330c2119a6736312bc to your computer and use it in GitHub Desktop.
Save adamluzsi/2f506ee18a3d9c330c2119a6736312bc to your computer and use it in GitHub Desktop.
Rack::App with basic auth
require 'rack/app'
class App < Rack::App
middlewares do |b|
b.use Rack::Auth::Basic, "Restricted Area" do |username, password|
[username, password] == ['admin', 'admin']
end
end
desc 'example static endpoint'
get '/' do
'hello world Rack::App'
end
end
run App
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment