From 992210d3edca80df71689065178a2e5a1cfac009 Mon Sep 17 00:00:00 2001 From: Asko Nõmm Date: Tue, 17 Feb 2026 23:03:14 +0200 Subject: Add Jank support --- README.md | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index d8d7e07..4197ee2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Ruuter -A tiny, zero dependency, system-agnostic router for Clojure, ClojureScript, Babashka and NBB that operates with a simple data structure where each route is a map inside a vector. Yup, that's it. No magic, no bullshit. +A tiny, zero dependency, system-agnostic router for Clojure, ClojureScript, Babashka, Jank and NBB that operates with a simple data structure where each route is a map inside a vector. Yup, that's it. No magic, no bullshit. ## Installation @@ -109,6 +109,42 @@ You can also use Ruuter with [Babashka](https://github.com/babashka/babashka), b @(promise) ``` +### Setting up with [Jank](https://jank-lang.org) + +[Jank](https://jank-lang.org) is a native Clojure dialect on LLVM. Since Ruuter is written in `.cljc` with `:jank` reader conditionals, it works with Jank directly. + +**Note:** Ruuter requires a recent Jank build from source (latest main). The 0.1 Homebrew release has a `clojure.string` codegen bug that prevents `clojure.string` from loading. This is fixed on main. See the [Jank build instructions](https://jank-lang.org/contribute/) for details. + +Create a file (e.g. `main.jank`) and point `--module-path` at Ruuter's `src` directory: + +```clojure +(ns example.main + (:require [ruuter.core :as ruuter])) + +(def routes [{:path "/" + :method :get + :response {:status 200 + :body "Hi there!"}} + {:path "/hello/:who" + :method :get + :response (fn [req] + {:status 200 + :body (str "Hello, " (:who (:params req)))})}]) + +(def request {:uri "/hello/world" + :request-method :get}) + +(println (ruuter/route routes request)) +``` + +Run it with: + +```bash +jank run --module-path src main.jank +``` + +See the `examples/jank-test-project/` directory for a complete example. + ### Creating routes Like mentioned above, each route is a map inside a vector. Routes are matched using **best-match semantics** — the most specific route wins regardless of order. @@ -235,6 +271,9 @@ clojure -M:cljs-test # Babashka bb test + +# Jank +./jank_test.sh ``` ### Running Benchmarks @@ -248,4 +287,7 @@ clojure -M:cljs-bench && node bench-out/bench.js # Babashka bb bench + +# Jank +jank run --module-path src:bench jank_bench_runner.jank ``` -- cgit v1.2.3 From f3c99d0d728d18342dd2fe72bb412a5bf3c5274d Mon Sep 17 00:00:00 2001 From: Asko Nõmm Date: Tue, 17 Feb 2026 23:04:38 +0200 Subject: Fix link pointing to build instructiosn for Jank --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 4197ee2..e67815f 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ You can also use Ruuter with [Babashka](https://github.com/babashka/babashka), b [Jank](https://jank-lang.org) is a native Clojure dialect on LLVM. Since Ruuter is written in `.cljc` with `:jank` reader conditionals, it works with Jank directly. -**Note:** Ruuter requires a recent Jank build from source (latest main). The 0.1 Homebrew release has a `clojure.string` codegen bug that prevents `clojure.string` from loading. This is fixed on main. See the [Jank build instructions](https://jank-lang.org/contribute/) for details. +**Note:** Ruuter requires a recent Jank build from source (latest main). The 0.1 Homebrew release has a `clojure.string` codegen bug that prevents `clojure.string` from loading. This is fixed on main. See the [Jank build instructions](https://github.com/jank-lang/jank/blob/main/compiler+runtime/doc/build.md) for details. Create a file (e.g. `main.jank`) and point `--module-path` at Ruuter's `src` directory: -- cgit v1.2.3