Skip to content
Create a gist now

Instantly share code, notes, and snippets.

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);
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.