Mountable Mars middleware for static site generation
Dependencies
deps: mars + markdown + luna (no edge to sol)moon add mizchi/astra
moon add mizchi/mars
moon add mizchi/lunamoon install mizchi/astra/cmd/astra # → $MOON_HOME/bin/astra
# or via npm
pnpm add -g @luna_ui/astra # 0.23.0# Static dump (writes <out>/<url>/index.html for every page URL)
astra build --out ./dist
# Dev server against the current directory's docs/ tree
astra dev --port 3000// Package imports are declared in moon.pkg, not in source:
// import { "mizchi/astra", "mizchi/astra/middleware", "mizchi/mars" }
let cfg = @astra.SsgConfig::default()
let mw = @middleware.create(cfg, cwd=".")
let app = @mars.Server::new()
app.all("/*", mw.handler())
// `to_handler()` yields the request handler; the runtime adapter drives it
// (a Node FFI listener in `astra dev`, `@adapters.cloudflare_handler` on
// Workers). Mars itself has no `listen`.
let handler = app.to_handler()website/
moon.mod # a module in your moon.work
03_astra/
moon.pkg # imports the packages the samples call
02_mount-on-mars.mbt.md # → /astra/mount-on-mars/
02_mount-on-mars.ja.mbt.md # → /ja/astra/mount-on-mars/Install
Download zipMountable Mars middleware for static site generation
Dependencies