#!/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';

Welcome to the Mojolicious real-time web framework!

To learn more, you can browse through the documentation <%= link_to 'here' => '/perldoc' %>. @@ layouts/default.html.ep <%= title %> <%= content %> @@ reverse.html.ep % layout 'default'; % title 'reverse'; <%= content %>