Rand Stats

Cro::WebApp::Evaluate

zef:librasteve

Cro::WebApp::Evaluate

so, basically this does the same as <?php mycode ?> does for php in html web content

sorry!

SYNOPSIS

Routes.rakumod

use Cro::HTTP::Router;
use Cro::WebApp::Template;
use Cro::WebApp::Evaluate;

sub routes() is export {
    route {
        evaluate-location 'evaluates';

        get -> {
            evaluate 'index.raku';
        }

        get -> *@path {
                static 'static', @path;
        }
    }
}

index.raku

<body>

<div class="container">
    <h1>Welcome to My Simple Raku Page!</h1>

    <p>
        Today is:
        <?raku
            #Get the current date and time
            use DateTime::Format;
            say strftime('%Y-%m-%d %H:%M:%S', DateTime.now);
        ?>
    </p>

    <p>
        Random number:
        <?raku
            #Generate a random number between 1 and 100
            say (^100).pick;
        ?>
    </p>
</div>

</body>

GETTING STARTED

Install raku - eg. from rakubrew, then:

Install Cro

Install this repo

Make a Cro server

Run and view it

You will note that cro has many other options as documented at Cro if you want to deploy to a production server.

DESCRIPTION

Cro::WebApp::Evaluate provides classis syntax to Cro.

AUTHOR

librasteve librasteve@furnival.net

COPYRIGHT AND LICENSE

Copyright 2024 librasteve

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.