1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
#!/usr/bin/env perl use Mojolicious::Lite; # Documentation browser under "/perldoc" plugin 'PODRenderer'; get '/' => sub { my $c = shift; $c->render(template => 'index'); }; put '/reverse' => sub { my $c = shift; my $hash = $c->req->json; $hash->{test} = reverse $hash->{test}; $c->render(json => $hash); }; app->start; __DATA__ @@ index.html.ep % layout 'default'; % title 'Welcome'; <h1>Welcome to the Mojolicious real-time web framework!</h1> To learn more, you can browse through the documentation <%= link_to 'here' => '/perldoc' %>. @@ layouts/default.html.ep <!DOCTYPE html> <html> <head><title><%= title %></title></head> <body><%= content %></body> </html> @@ reverse.html.ep % layout 'default'; % title 'reverse'; <%= content %>
QuoteMalne Frage zu Mojolicious:
Wenn eine WebSite 3...