Joel Berger
and 1 contributors

NAME

Mojolicious::Plugin::MountPSGI - Mount PSGI apps

SYNOPSIS

  # Mojolicious
  $self->plugin('MountPSGI', { '/' => 'ext/MyApp/app.psgi'});

  # Mojolicious::Lite
  plugin 'MountPSGI', { '/' => 'ext/MyApp/app.psgi' };

  # rewrite the path so the psgi app doesn't see the mount point
  # thus app.psgi sees / when /mount is visited
  plugin 'MountPSGI, { '/mount' => 'ext/MyApp/app.psgi', rewrite => 1 };

DESCRIPTION

Mojolicious::Plugin::MountPSGI lets you mount any PSGI app inside a Mojolicious app. For instance you could use this to deploy your PSGI app under hypnotoad, or to include a PSGI app inside a path inside your Mojo app.

The key given is the route under which to mount the app. The value is either a PSGI application or a string which resolves to an instance via "load_psgi" in Plack::Util.

One additional option is rewrite which if set to a true value will rewrite the PATH_INFO and SCRIPT_NAME values in the env hash so that the application does not see the mount point in its request path. This uses the mechanism as described by Plack::App::URLMap.

METHODS

Mojolicious::Plugin::MountPSGI inherits all methods from Mojolicious::Plugin and implements the following new ones.

register

  $plugin->register;

Register plugin in Mojolicious application.

SEE ALSO

Mojolicious, Mojolicious::Guides, http://mojolicio.us.

CONTRIBUTORS

    Joel Berger

COPYRIGHT

Most of this module was assembled from the Mojo mount plugin and the Mojolicious-Plugin-PlackMiddleware plugin. Copyright on that code belongs to the authors.

The remainder is (C) 2011-2015 Marcus Ramberg

LICENSE

Licensed under the same terms as Perl itself.