Skip to content

Instantly share code, notes, and snippets.

@marcusramberg
Created February 4, 2019 15:00
Show Gist options
  • Save marcusramberg/d0444a8b1eb5ac5b179cf6c171107a8a to your computer and use it in GitHub Desktop.
Save marcusramberg/d0444a8b1eb5ac5b179cf6c171107a8a to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use Mojolicious::Lite;
get '/' => sub {
my $c = shift;
$c->render_later;
$c->ua->get('/internal', sub {
my ($ua,$tx)=@_;
$c->render(text=>$tx->res->json('/res'));
});
};
get '/internal' => sub {
my $c = shift;
$c->render( json=> {res=>'2'} );
};
app->start;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment