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';
</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(). Shared State How shared state across islands works — two separate islands driving the same reactive $state.