File Routes
You can serve a file straight from disk with Mochi.file() — pass a static path, or a resolver that picks the file per request from the route params. The file is read fresh on every request, so files written or deleted at runtime are picked up immediately. Missing files (or a resolver that throws error(404)) come back as a plain-text 404.
<script>
import FileViewer from './FileViewer.svelte';
import { files } from './files.ts';
const sources = await loadSources(files);
</script>
<FileViewer mochi:hydrate />
More demos
Hello World How server-side rendering works — a Mochi.page() renders Svelte on the server and ships zero JavaScript. Server Props How server props work — pass fresh per-request data into a page via serverProps on Mochi.page(). Real-time Streams How server-sent events and WebSocket streaming work — live SSE and WebSocket clocks, lazily hydrated via mochi:hydrate:visible.