Add basic-site
This commit is contained in:
parent
1eb445d433
commit
b0398537f6
|
@ -6,6 +6,10 @@ jesus fuck what is this
|
|||
|
||||
How are recursive function calls impacted by dynamic variables?
|
||||
|
||||
## multipart-form.raku
|
||||
## multipart-form
|
||||
|
||||
Process uploaded files with Humming-Bird
|
||||
|
||||
## basic-site
|
||||
|
||||
Serve a simple static site with Humming-Bird
|
||||
|
|
20
basic-site/basic-site.raku
Executable file
20
basic-site/basic-site.raku
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env raku
|
||||
|
||||
use v6.d;
|
||||
use Humming-Bird::Core;
|
||||
use Humming-Bird::Middleware;
|
||||
use Humming-Bird::Advice;
|
||||
use Template::Mustache;
|
||||
|
||||
middleware &middleware-logger;
|
||||
advice &advice-logger;
|
||||
|
||||
my $template = Template::Mustache.new: :from<./templates>;
|
||||
|
||||
get '/', -> $request, $response {
|
||||
my Str %stash = title => 'Hello, web!';
|
||||
|
||||
$response.html($template.render: 'index', %stash);
|
||||
};
|
||||
|
||||
listen 3000;
|
10
basic-site/templates/index.mustache
Normal file
10
basic-site/templates/index.mustache
Normal file
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{{title}}</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>{{title}}</h1>
|
||||
<p>We will we will... RAKU!!</p>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue