diff options
Diffstat (limited to '')
-rw-r--r-- | app.psgi | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/app.psgi b/app.psgi index c4ed02b..7a7aecf 100644 --- a/app.psgi +++ b/app.psgi @@ -1,13 +1,25 @@ # PSGI application bootstraper for Dancer -use lib '/home/franck/tmp/dancerREST'; -use dancerREST; +use lib 'lib'; +use Dancer; +load_app 'dancerREST'; use Dancer::Config 'setting'; -setting apphandler => 'PSGI'; +setting apphandler => 'PSGI'; Dancer::Config->load; +use Plack::Builder; -my $handler = sub { - my $env = shift; +my $app = sub { + my $env = shift; my $request = Dancer::Request->new($env); Dancer->dance($request); }; + +builder { + enable "Auth::Basic", authenticator => \&authen_cb; + $app; +}; + +sub authen_cb { + my ( $username, $password ) = @_; + return $username eq 'admin' && $password eq 'admin'; +} |