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

    Module @anzaui/engine/adapters/express

    Express helpers. The response is typed as any, so this module does not depend on Express.

    import express from 'express';
    import { Fragment, Page, Setup } from '@anzaui/engine';
    import { sendHtml, sendJson, sendSse } from '@anzaui/engine/adapters/express';

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

    app.get('/', async (req, res) => sendHtml(res, await new Page('/', { title: 'Express' }).run(engine)));
    app.get('/card', async (req, res) => sendJson(res, await new Fragment('feed/card.html', 'main', { status: 'online' }).run(engine)));

    app.get('/stream', (req, res) => {
    res.writeHead(200, { 'Content-Type': 'text/event-stream', 'Cache-Control': 'no-cache', Connection: 'keep-alive' });
    const timer = setInterval(async () => {
    sendSse(res, await new Fragment('feed/card.html', 'feed', { title: 'Live Update' }).run(engine));
    }, 2000);
    req.on('close', () => clearInterval(timer));
    });

    app.listen(3000);
    sendHtml
    sendJson
    sendSse