From b0398537f6720d689f3206a1bd8320f187149c82 Mon Sep 17 00:00:00 2001 From: swaggboi Date: Thu, 9 Nov 2023 21:37:39 -0500 Subject: [PATCH] Add basic-site --- README.md | 6 +++++- basic-site/basic-site.raku | 20 +++++++++++++++++++ basic-site/templates/index.mustache | 10 ++++++++++ .../multipart-form.raku | 0 .../templates}/index.mustache | 0 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100755 basic-site/basic-site.raku create mode 100644 basic-site/templates/index.mustache rename multipart-form.raku => multipart-form/multipart-form.raku (100%) rename {templates => multipart-form/templates}/index.mustache (100%) diff --git a/README.md b/README.md index 2839b4c..9ce722d 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/basic-site/basic-site.raku b/basic-site/basic-site.raku new file mode 100755 index 0000000..e223f8d --- /dev/null +++ b/basic-site/basic-site.raku @@ -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; diff --git a/basic-site/templates/index.mustache b/basic-site/templates/index.mustache new file mode 100644 index 0000000..0fd71c9 --- /dev/null +++ b/basic-site/templates/index.mustache @@ -0,0 +1,10 @@ + + + + {{title}} + + +

{{title}}

+

We will we will... RAKU!!

+ + diff --git a/multipart-form.raku b/multipart-form/multipart-form.raku similarity index 100% rename from multipart-form.raku rename to multipart-form/multipart-form.raku diff --git a/templates/index.mustache b/multipart-form/templates/index.mustache similarity index 100% rename from templates/index.mustache rename to multipart-form/templates/index.mustache