diff options
author | Dylan William Hardison <dylan@hardison.net> | 2018-04-04 05:05:04 +0200 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2018-06-28 22:41:54 +0200 |
commit | ed6d5cdaaeac6422e5933e4e8138b481e35ab4f3 (patch) | |
tree | 821e7a1330326e5d9630560076049bce01f3c3d6 /new.psgi | |
parent | 5d6d68697dceec6a8c5a8947118abe527ad09ba1 (diff) | |
download | bugzilla-ed6d5cdaaeac6422e5933e4e8138b481e35ab4f3.tar.gz bugzilla-ed6d5cdaaeac6422e5933e4e8138b481e35ab4f3.tar.xz |
initial proof of concept of mojolicious inside bmo
Diffstat (limited to 'new.psgi')
-rwxr-xr-x | new.psgi | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/new.psgi b/new.psgi new file mode 100755 index 000000000..8f1484d91 --- /dev/null +++ b/new.psgi @@ -0,0 +1,45 @@ +#!/usr/bin/env perl +use Mojolicious::Lite; +use Bugzilla::Constants; +use Bugzilla::CGI::Mojo; +use Try::Tiny; + +plugin 'PODRenderer'; + + +app->hook( + around_dispatch => sub { + my ($next, $c) = @_; + try { + local %{ Bugzilla->request_cache } = (); + Bugzilla->usage_mode(USAGE_MODE_MOJO); + Bugzilla->cgi( Bugzilla::CGI::Mojo->new(controller => $c) ); + $next->(); + } catch { + die $_ unless /\bModPerl::Util::exit\b/; + }; + } +); + +get '/' => sub { + my $c = shift; + my $user = Bugzilla->login(LOGIN_OPTIONAL); + $c->render( template => 'index', user => $user ); +}; + +app->start; +__DATA__ + +@@ index.html.ep +% layout 'default'; +% title 'Welcome'; + +<p>Hello, <%= $user->name %> <<%= $user->email %>> +</p> + +@@ layouts/default.html.ep +<!DOCTYPE html> +<html> + <head><title><%= title %></title></head> + <body><%= content %></body> +</html> |