Added URLMap support (e.g. virtual hosts and mounting)
This commit is contained in:
parent
e15c32e3f7
commit
2516ff12c1
10 changed files with 54 additions and 22 deletions
12
eg/basic.psgi
Normal file
12
eg/basic.psgi
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
use lib '/data/WebGUI/lib';
|
||||
use WebGUI;
|
||||
|
||||
# Some ways to achieve the same thing from the command line:
|
||||
# plackup -MWebGUI -e 'WebGUI->new'
|
||||
# plackup -MWebGUI -e 'WebGUI->new("dev.localhost.localdomain.conf")'
|
||||
# plackup -MWebGUI -e 'WebGUI->new(root => "/data/WebGUI", site => "dev.localhost.localdomain.conf")'
|
||||
#
|
||||
# Or from a .psgi file:
|
||||
# my $app = WebGUI->new( root => '/data/WebGUI', site => 'dev.localhost.localdomain.conf' )->psgi_app;
|
||||
# Or equivalently (using the defaults):
|
||||
WebGUI->new;
|
||||
20
eg/urlmap.psgi
Normal file
20
eg/urlmap.psgi
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
use lib '/data/WebGUI/lib';
|
||||
use WebGUI;
|
||||
|
||||
my $wg1 = WebGUI->new;
|
||||
my $wg2 = WebGUI->new;
|
||||
|
||||
use Plack::Builder;
|
||||
my $app = builder {
|
||||
mount "http://dev.localhost.localdomain:5000/" => $wg1;
|
||||
mount "/wg1" => $wg1;
|
||||
mount "/wg2" => $wg2;
|
||||
mount "/" => sub { [ 200, [ 'Content-Type' => 'text/html' ], [ <<END_HTML ] ] };
|
||||
<p>WebGUI + URLMap</p>
|
||||
<ul>
|
||||
<li><a href="http://dev.localhost.localdomain:5000">Virtual Host (wG instance #1)</a></li>
|
||||
<li><a href=/wg1>Nested (wG instance #1)</a></li>
|
||||
<li><a href=/wg2>Nested (wG instance #2)</a></li>
|
||||
</ul>
|
||||
END_HTML
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue