@gomani/server
v0.3.0
Published
Web-standard request handling, SSR-to-HTML, data co-location.
Downloads
88
Maintainers
Readme
@gomani/server
Web-standard request handling, SSR-to-HTML, and static serving for Gomani.
Authored against the web-standard Request/Response, so it runs on Node (via a thin adapter here)
and on edge runtimes. Its constraint-first role: co-locate critical data with the initial document
(killing client waterfalls — the latency axis), render with zero client JS outside islands, and
serve compressed, aggressively-cacheable assets.
SSR composition
import { renderPage, renderDocument } from '@gomani/server';
const { html, islands } = await renderPage({ route, layouts, params, request, url });
const document = renderDocument({ bodyHtml: html, head, islands, manifest });renderPage runs co-located loaders (route + layouts), wraps the page in its layout chain, and renders
the tree to HTML. renderDocument wraps that body in a full document, injecting the island manifest +
one boot script only when the page has islands.
Serving a build
import { serveStatic, toNodeListener } from '@gomani/server';
import { createServer } from 'node:http';
const handler = serveStatic('dist', { immutablePrefix: '/_gomani/' });
createServer(toNodeListener(handler)).listen(4000);serveStatic resolves pretty URLs to index.html, Brotli-compresses text responses when accepted, and
marks content-hashed asset URLs immutable. toNodeListener bridges the web handler onto node:http.
License
MIT © Venancio Gomani / Kwacha Kulture.
