Logo

dev-resources.site

for different kinds of informations.

Introducing Humming-Bird v3

Published at
11/8/2023
Categories
raku
rakulang
webdev
programming
Author
rawleyfowler
Categories
4 categories in total
raku
open
rakulang
open
webdev
open
programming
open
Author
12 person written this
rawleyfowler
open
Introducing Humming-Bird v3

Hey folks! It's been a while!

I've been busy, but I haven't forgotten about Humming-Bird. Actually I've been quite busy trying to figure out Web-Sockets, and swappable back-ends for Humming-Bird, features requested by many!

Web-Sockets have been put on the back-burner for a bit, but swappable back-ends, and many bug-fixes have been completed leading to a new version bump.

A lot has changed, and I'm excited to see what sort of back-ends the community may come up with.

To implement a Humming-Bird back-end, simply write a class that does Humming-Bird::Backend;, and implement the listen routine, with a single argument of a function that takes a Humming-Bird::Glue::Request and returns a Humming-Bird::Glue::Response:

use Humming-Bird::Glue;

unit role Humming-Bird::Backend::MyBackend;

method listen(&handler) {
    my $request  = Humming-Bird::Glue::Request.decode(somehow-get-http-request());
    my $response = &handler($request);
    somehow-send-http-response($response.encode);
}
Enter fullscreen mode Exit fullscreen mode

Now in your Humming-Bird app add the following to the listen clause:

use Humming-Bird::Core;

get('/', -> $request, $response {
    $response.html("Hello World!");
});

listen(:backend(Humming-Bird::Backend::MyBackend));
Enter fullscreen mode Exit fullscreen mode

Thanks for reading, Raku rocks!

raku Article's
30 articles in total
Favicon
SSH port forwarding from within code
Favicon
SSH port forwarding from within Raku code
Favicon
Solving the Weekly Challenge 302 Task 1: Ones and Zeroes in Python
Favicon
Solving the Weekly Challenge 302 Task 2: Step by Step in Python
Favicon
My Python Language Solution to Task 2: Nested Array from The Weekly Challenge 300
Favicon
My Python Language Solution to Task 1: Beautiful Arrangement from The Weekly Challenge 300
Favicon
My Python Language Solution to Task 1 from The Weekly Challenge 299
Favicon
Sparky - composable user interfaces for internal services
Favicon
Sparky - hacking minikube with mini tool
Favicon
Sparky - simple and efficient alternative to Ansible
Favicon
Confirming The LPW 2024 Venue & Date
Favicon
Announcing The London Perl & Raku Workshop 2024
Favicon
Stability
Favicon
Practicing Raku Grammars On Exercism
Favicon
Languages wanted!
Favicon
Perl and Raku Dev Room @FOSDEM 24
Favicon
Introducing Humming-Bird v3
Favicon
Publishing Raku modules
Favicon
Sorting numbers in Raku with the help of ChatGPT
Favicon
UTF-8 series wrap up
Favicon
UTF-8 Byte Order Mark
Favicon
Fun with UTF-8: Homoglyphs
Favicon
UTF-8 regular expressions
Favicon
Fun with UTF-8: variables and operators
Favicon
UTF-8 sorting and collation
Favicon
UTF-8 grapheme clusters
Favicon
UTF-8 (de)composition
Favicon
UTF-8 code point properties
Favicon
Fun with UTF-8: browsing code points namespace
Favicon
UTF-8 Glyphs and Graphemes

Featured ones: