#!/usr/bin/env raku =begin pod =begin comment uuuuuuu uu$$$$$$$$$$$uu uu$$$$$$$$$$$$$$$$$uu u$$$$$$$$$$$$$$$$$$$$$u u$$$$$$$$$$$$$$$$$$$$$$$u u$$$$$$$$$$$$$$$$$$$$$$$$$u u$$$$$$$$$$$$$$$$$$$$$$$$$u u$$$$$$" "$$$" "$$$$$$u "$$$$" u$u $$$$" $$$u u$u u$$$ $$$u u$$$u u$$$ "$$$$uu$$$ $$$uu$$$$" "$$$$$$$" "$$$$$$$" u$$$$$$$u$$$$$$$u u$"$"$"$"$"$"$u uuu $$u$ $ $ $ $u$$ uuu u$$$$ $$$$$u$u$u$$$ u$$$$ $$$$$uu "$$$$$$$$$" uu$$$$$$ u$$$$$$$$$$$uu """"" uuuu$$$$$$$$$$ $$$$"""$$$$$$$$$$uuu uu$$$$$$$$$"""$$$" """ ""$$$$$$$$$$$uu ""$""" uuuu ""$$$$$$$$$$uuu u$$$uuu$$$$$$$$$uu ""$$$$$$$$$$$uuu$$$ $$$$$$$$$$"""" ""$$$$$$$$$$$" "$$$$$" ""$$$$"" $$$" $$$$" =end comment =end pod use v6.d; use Humming-Bird::Core; use Humming-Bird::Middleware; use Humming-Bird::Advice; use Template::Mustache; # 'Config-y' stuff my $template = Template::Mustache.new: :from<./templates>; middleware &middleware-logger; advice &advice-logger; # Begin routing get '/', -> $request, $response { my Str %stash = title => 'File upload'; $response.html($template.render: 'index', %stash); }; post '/', -> $request, $response { # This works: #my Str $filename = # $request.content ~ # '.' ~ # $request.content.split('/')[1]; #my Buf $file-body = $request.content; # #('uploads/' ~ $filename).IO.spurt: $file-body; # Not sure about this: dd $request.content.decode; # Works! dd $request.content; # Doesn't like hyphen? $response.redirect('/'); }; # Send it listen 3000;