Created
December 20, 2015 19:42
-
-
Save jberger/39be1ed802de4c5c4aad to your computer and use it in GitHub Desktop.
A plack handler for Mojo Daemon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Plack::Handler::Mojo::Server::Daemon; | |
use Mojolicious; | |
use Mojo::Server::Daemon; | |
sub new { | |
my $class = shift; | |
my $self = { | |
options => {@_}, | |
}; | |
require Data::Dumper; | |
warn Data::Dumper::Dumper($self); | |
return bless $self, $class; | |
} | |
sub run { | |
my ($self, $psgi) = @_; | |
my $app = Mojolicious->new; | |
$app->plugin('Mojolicious::Plugin::MountPSGI' => { '/' => $psgi }); | |
Mojo::Server::Daemon->new(app => $app, listen => $self->{options}{listen})->run; | |
} | |
1; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment