@anzaui/engine - v0.6.0
    Preparing search index...

    Module @anzaui/engine/adapters/web

    Helpers that build a web-standard Response, for servers with a fetch(request) handler such as Bun, Deno and Node.js 18+.

    The same functions are exported from the package root and as adapters.web. The engine itself still needs node:fs and node:crypto, so this runs on Node, Bun and Deno, not on filesystem-less edge runtimes.

    import { Fragment, Page, Setup } from '@anzaui/engine';
    import { htmlResponse, jsonResponse } from '@anzaui/engine/adapters/web';

    const engine = await new Setup({ root: './templates' }).run();

    export default {
    async fetch(req: Request): Promise<Response> {
    const url = new URL(req.url);
    if (url.pathname === '/') return htmlResponse(await new Page('/', { title: 'Home' }).run(engine));
    if (url.pathname === '/card') return jsonResponse(await new Fragment('feed/card.html', 'feed', { title: 'Card' }).run(engine));
    return new Response('Not Found', { status: 404 });
    },
    };
    htmlResponse
    jsonResponse
    sseEvent