Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jolt-lang/router (reitit on Jolt)

reitit routing for Jolt.

reitit-core's fast router is built on a Java class (reitit.Trie). Jolt has no JVM, so reitit.trie-jolt reimplements that trie in Clojure and registers it as a reitit.Trie host class through jolt's class-shim hooks — then reitit-core itself loads unmodified from git and routes normally.

Usage

Load with JOLT_FEATURES including clj (so reitit reads its :clj branches), require reitit.trie-jolt before building a router, and use reitit-core as usual:

(require '[reitit.trie-jolt]          ; registers the Trie mirror
         '[reitit.core :as r])

(def router
  (r/router [["/api/users"      :users]
             ["/api/users/:id"  :user]
             ["/files/*path"    :files]]))

(r/match-by-path router "/api/users/42")
;; => #reitit.core.Match{:data :user :path-params {:id "42"} ...}
;; deps.edn — pull reitit-core (a monorepo) + this adapter
:deps {metosin/reitit-core {:git/url "https://github.com/metosin/reitit"
                            :git/sha "..." :deps/root "modules/reitit-core"}
       weavejester/meta-merge {:git/url "https://github.com/weavejester/meta-merge"
                               :git/sha "..."}
       jolt-lang/router {:git/url "https://github.com/jolt-lang/router" :git/sha "..."}}

The ring-app example uses it to route a real web app.

Tests

JOLT_FEATURES=clj,jolt,default jolt-deps -M:test

About

A router wrapper for Reitit

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages