add bookshelf
This commit is contained in:
15
bookshelf/bookshelf.raku
Normal file
15
bookshelf/bookshelf.raku
Normal file
@@ -0,0 +1,15 @@
|
||||
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);
|
||||
Reference in New Issue
Block a user