Inching Forward


Finding Joy: Middleware

In this series of posts, we are working our way up to understanding the Joy web framework by creating the building blocks ourselves. See part 1 and part 2. Let’s start simple again: (import halo) (defn hello [request] {:status 200 :body "Hello, world!"}) (halo/server hello 8080) The thing I want to point out here is the call to halo/server. It seems kinda crazy that we could build a powerful, modern web app by passing one handler function to the server.

Finding Joy: Handlers

In part 1, we created a very simple web app: (import halo) (defn hello [request] {:status 200 :body "Hello, world!" :headers {"Content-Type" "text/plain"}}) (halo/server hello 8080) Let’s dig into this. First we import the halo module. The halo module contains the server function which starts the server up and listens for requests. We can call it by prefixing it with the module name: halo/server. The server function takes 2 arguments: a handler function, which we have defined as hello, and a port to run on.

Finding Joy: First Steps

Lately I’ve been having fun playing around with the Janet programming language. Janet is a small Lisp with a Clojure-inspired syntax. A few of my favorite things about it: Janet apps start instantaneously, consume little memory, and can be compiled to a single binary for easy deployment. For someone with a personal web app creation habit and a simple vps, Janet seems like a great choice. Since most of my personal projects are web apps, I quickly found the Joy web framework by Sean Walker.