Files
site/bookshelf/bookshelf.raku
2023-01-25 01:10:36 +00:00

16 lines
418 B
Raku

use v6.d;
use Humming-Bird::Core;
use Template::Mustache;
my constant $BOOKSHELF-LOCATION = 'bookshelf.txt';
my $tmpl = Template::Mustache.new: :from<.>;
get('/bookshelf', -> $request, $response {
my @books = $BOOKSHELF-LOCATION.IO.lines>>.split('^').map(-> ($name, $author, $href, $rating) { %(:$name, :$author, :$href, :$rating) });
$response.html($tmpl.render('bookshelf', { :@books }));
});
listen(8888);