1Mojolicious::Plugin::MoUusnetr(3C)ontributed Perl DocumeMnotjaotliiocnious::Plugin::Mount(3)
2
3
4
6 Mojolicious::Plugin::Mount - Application mount plugin
7
9 # Mojolicious
10 my $route = $app->plugin(Mount => {'/prefix' => '/home/sri/foo/script/foo'});
11
12 # Mojolicious::Lite
13 my $route = plugin Mount => {'/prefix' => '/home/sri/myapp.pl'};
14
15 # Adjust the generated route and mounted application
16 my $example = plugin Mount => {'/example' => '/home/sri/example.pl'};
17 $example->to(message => 'It works great!');
18 my $app = $example->pattern->defaults->{app};
19 $app->config(foo => 'bar');
20 $app->log(app->log);
21
22 # Mount application with host
23 plugin Mount => {'example.com' => '/home/sri/myapp.pl'};
24
25 # Host and path
26 plugin Mount => {'example.com/myapp' => '/home/sri/myapp.pl'};
27
28 # Or even hosts with wildcard subdomains
29 plugin Mount => {'*.example.com/myapp' => '/home/sri/myapp.pl'};
30
32 Mojolicious::Plugin::Mount is a plugin that allows you to mount whole
33 Mojolicious applications.
34
35 The code of this plugin is a good example for learning to build new
36 plugins, you're welcome to fork it.
37
38 See "PLUGINS" in Mojolicious::Plugins for a list of plugins that are
39 available by default.
40
42 Mojolicious::Plugin::Mount inherits all methods from
43 Mojolicious::Plugin and implements the following new ones.
44
45 register
46 my $route = $plugin->register(Mojolicious->new, {'/foo' => '/some/app.pl'});
47
48 Mount Mojolicious application and return the generated route, which is
49 usually a Mojolicious::Routes::Route object.
50
52 Mojolicious, Mojolicious::Guides, <https://mojolicious.org>.
53
54
55
56perl v5.34.0 2021-07-22 Mojolicious::Plugin::Mount(3)