Made a template

This commit is contained in:
swagg boi 2023-09-24 00:45:18 -04:00
parent 3422a072e6
commit 80786d4a2b
3 changed files with 20 additions and 2 deletions

View file

@ -1,6 +1,9 @@
{
"name": "Hyperlink-Redirect",
"depends": ["Humming-Bird"],
"depends": [
"Humming-Bird",
"Template6"
],
"provides": {
"Hyperlink-Redirect": "lib/Hyperlink-Redirect.rakumod"
}

View file

@ -1,13 +1,18 @@
use v6.d;
use Humming-Bird::Core;
use Template6;
# Normally would 'use' local libs here for Controller and Model and
# what not but keeping it simple for now...
# Where art thou templates
my $templates = Template6.new;
$templates.add-path: 'templates';
# Must set the root path lest yet miss setting $!root
my $router = Router.new(root => '/');
$router.get(-> $request, $response {
$response.write('testing 123...')
$response.html($templates.process: 'index');
});

10
templates/index.tt Normal file
View file

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test page</title>
</head>
<body>
<h1>Ayy...</h1>
<p>lmao</p>
</body>
</html>