mirror of
https://github.com/ryukoposting/kroutes
synced 2026-01-15 05:21:43 +00:00
No description
| demo | ||
| src | ||
| tests | ||
| .gitignore | ||
| CHANGELOG.md | ||
| kroutes.nimble | ||
| README.md | ||
KRoutes is a client-side router for karax.
Features
- Easy to retrofit into existing Karax apps.
- Support for both client-side and server-side HTML rendering.
- Extensibility via method overloading.
- Utility procs for site navigation.
- Routing with path parameters.
- Optional RAM-cached SSR responses to reduce server load.
- Only one dependency: Karax (which you're using anyway, if you're using this package!)
Simple Example
include karax/prelude
import kroutes
let router = newRouter()
router.addRoute("/") do (ctx: Context) -> VNode:
buildHtml(main):
button(onclick = goto("/clicked")): text "Click the button."
button(onclick = goto("/blog_post")): text "Go to the blog post."
router.addRoute("/clicked") do (ctx: Context) -> VNode:
buildHtml(main):
text "You clicked the button!"
button(onclick = goBack()): text "Go back."
router.addSsrRoue("/blog_post")
setRenderer(router)
Demo app
The demo/ directory contains a simple web app using Prologue, Karax, and KRoutes. It uses both client-side and server-side rendering.