📦 How to import Rhyla (Express client)

⚡ JavaScript — Quick start

Importing and using the Rhyla Express helper is straightforward:

// Import the main client
import express from 'express';
import RhylaClient from 'rhyla';

const app = express();

// Serve the built documentation at the /docs path
RhylaClient.expressConfig(app, '/docs');

✅ Prerequisites

rhyla build

📁 Using a custom output directory (distDir)

If you changed the build output directory, pass the same path to expressConfig using the distDir option. Note: distDir must point to the built output — pointing to source files or templates will not work.

// Example: the build was configured to write to './public/docs'
RhylaClient.expressConfig(app, '/docs', { distDir: './public/docs' });

expressConfig will also try to read config.json inside the build output to detect any base path defined at build time. If a base is present in the built config.json, expressConfig will prefer the explicit base you pass as first argument when present.


⚠️ Important note about base path

ℹ️ Notes

Example:

// Build-time: config.base is '/' (default)
// Wrong — this will likely break paths because the build expects '/'
RhylaClient.expressConfig(app, '/docs');

// Correct — mount at the same base the site was built with
RhylaClient.expressConfig(app, '/');

Recommendation: set the intended base in your Rhyla config before running rhyla build, or mount the built site using the same base you built it with.