Skip to content

Instantly share code, notes, and snippets.

@daoswald
Created February 29, 2020 22:52
Show Gist options
  • Save daoswald/2abd9d3b437863ee8b0b7c569be54616 to your computer and use it in GitHub Desktop.
Save daoswald/2abd9d3b437863ee8b0b7c569be54616 to your computer and use it in GitHub Desktop.
curl -l http://localhost:3000/bar.html
HASH(0x55bcb62743c8)
cat myapp.pl
#!/usr/bin/env perl
use Mojolicious::Lite;
get '/bar' => sub {
my $data = {one => {foo => 1}, two => 24};
shift()->respond_to(
json => {json => $data},
any => {template => 'mytest', data => $data},
);
};
app->start;
__DATA__
@@ mytest.html.ep
<p>
The data is:</p>
<pre>
%= dumper $data
</pre>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment