| 1 | %% cascade "Minimum/script/server.pl" | ||
| 2 | |||
| 3 | %% override load_modules -> { | ||
| 4 | use <% $module %>::Web; | ||
| 5 | use <% $module %>; | ||
| 6 | use URI::Escape; | ||
| 7 | use File::Path (); | ||
| 8 | use Plack::Session::Store::File; | ||
| 9 | %% } | ||
| 10 | |||
| 11 | %% override app -> { | ||
| 12 | my $session_dir = File::Spec->catdir(dirname(__FILE__), '..', 'tmp', 'session'); | ||
| 13 | File::Path::mkpath($session_dir); | ||
| 14 | |||
| 15 | my $app = builder { | ||
| 16 | enable 'Plack::Middleware::Static', | ||
| 17 | path => qr{^(?:/static/)}, | ||
| 18 | root => File::Spec->catdir(dirname(__FILE__), '..'); | ||
| 19 | enable 'Plack::Middleware::Static', | ||
| 20 | path => qr{^(?:/robots\.txt|/favicon\.ico)$}, | ||
| 21 | root => File::Spec->catdir(dirname(__FILE__), '..', 'static'); | ||
| 22 | enable 'Plack::Middleware::ReverseProxy'; | ||
| 23 | enable 'Plack::Middleware::Session', | ||
| 24 | store => Plack::Session::Store::File->new( | ||
| 25 | dir => $session_dir, | ||
| 26 | ); | ||
| 27 | |||
| 28 | <% $module %>::Web->to_app(); | ||
| 29 | }; | ||
| 30 | %% } |