4 # Documentation browser under "/perldoc"
9 use Data::Dump qw(dump);
13 my $json = Mojo::JSON->new;
14 my $client = Mojo::UserAgent->new;
16 post '/collector' => sub {
18 my $data = XMLin( $self->req->body );
21 # post will create new dockument, put will insert known key
22 my $key = sprintf "%10.5f", Time::HiRes::time;
23 my $res = $client->put( "http://localhost:5984/mmonit/$key" => { 'Content-Type' => 'application/json' } => $json->encode( $data ) )->res->json;
25 warn "# res = ",dump($res);
27 $self->render('index');
36 Welcome to Mojolicious!
38 @@ layouts/default.html.ep
40 <head><title><%= title %></title></head>
41 <body><%= content %></body>