Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View hello.pl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
use Mojolicious::Lite;
use Data::Dump;
use JSON;
 
get '/' => {text => 'Hello World!'};
 
post '/greet' => sub {
my $self = shift;
my $name = $self->param('name') || 'World';
$self->render( text => "Hello, " . ucfirst $name . "!\n" );
};
 
put '/person' => sub {
my $self = shift;
my $data = $self->req->body;
dd decode_json $data;
$self->render(json => $data);
};
 
app->start;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.