/home/rawley.xyz

Introducing Humming-Bird!

TLDR: I wrote a web framework for Raku, you can check it out here.

Since the beginning of December, because of Advent of Code (which I have yet to finish), I decided I would try Raku. Raku is a weird language, and I say that in a good way. It encourages the use of Unicode symbols, and terseness while still managing to feel like a better Perl. It‘s a really good experience, and I recommend the skeptics to give it a try!

Anyways. I wanted to build a simple web service in Raku, and was suprised that there was very few options for doing this. I could use a project called `Cro`, but it felt more like a tool set rather than a framework, so I decided against it. Besides Cro, the landscape was fairly barren. So. I built my own!

I named this project Humming-Bird, and set out on building a simple Sinatra like framework for the world of Raku. To my suprise, Raku is REALLY good at this kind of work. Raku has effect driven IO (something OCaml just got), and I was able to write a simple, multi-process, HTTP server within a few minutes. Then, all I needed to do was abstract upon the requests and responses. This was also really nice. Raku, like Perl, has extensive Regex support so I was easily able to encode and decode HTTP requests into Raku objects and data structures. Then, from there all I needed to do was route these requests. Right now, routing is handled by a HashTrie style data structure, but I think a better solution will be in the form of a Radix Trie, but that will be a project for another day. After I put all of these small pieces together, I was left with a very simple, almost functional (as in programming) web framework. In less than 10 LOC you can spin up a simple web-app that says "Hello World" in h1 tags. Nice.

The most recent addition to the framework (this was merged 2 hours ago), is middleware. This allows users to define various simple pieces of functionality and compose them together to create complex systems.

Going Forward

This project has been super fun to work on, and I hope to keep improving it as time goes on. Since middleware was implemented, I want to benchmark this framework, and hopefully learn more about MoarVM in the process. Anyways, if you want to give this framework a try (please do!), you can clone it from here, note you‘ll need Rakudo, and Zef installed to use it!