Skip to content

Commit

Permalink
recommend wrapper scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Sep 12, 2011
1 parent de27b42 commit 6ad59ed
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions lib/Mojolicious/Guides/Cookbook.pod
Expand Up @@ -154,30 +154,30 @@ variable.

=head2 Plack Middleware

You can use middleware right in your application.
Wrapper scripts like C<myapp.fcgi> are a great way to separate deployment and
application logic.

use Mojolicious::Lite;
#!/usr/bin/env plackup -s FCGI
use Plack::Builder;

get '/welcome' => sub {
my $self = shift;
$self->render(text => 'Hello Mojo!');
};

builder {
enable 'Deflater';
app->start;
require 'myapp.pl';
};

For more control you can even use deployment specific wrappers like
C<myapp.fcgi>.
But you could even use middleware right in your application.

#!/usr/bin/env plackup -s FCGI
use Mojolicious::Lite;
use Plack::Builder;

get '/welcome' => sub {
my $self = shift;
$self->render(text => 'Hello Mojo!');
};

builder {
enable 'Deflater';
require 'myapp.pl';
app->start;
};

=head2 Rewriting
Expand Down

0 comments on commit 6ad59ed

Please sign in to comment.