Docs
/

@leumas/static-pages

Imperium static-pages plugin router — CRUD over on-disk per-config page files (.json/.md/.html/.jsx). Consolidates the read-only StaticPages fetch/list router into a full CRUD surface for Studio.

@leumas/static-pages

Imperium static-pages plugin router — CRUD over an on-disk, per-config corpus of page files (.json / .md / .html / .jsx). Each config folder is one subdomain's static-page set (the z.Domains2/StaticPages model). Mounted by leumas-api alongside the other router-kit routers.

Absorbs (DRY-consolidated from): z.Domains2/Router/StaticPagesrouter.js + handlers/{list-pages,fetch-page} + utils/{file,request,response}. The legacy router was read-only (list + fetch); this adds the write half (create/overwrite/delete pages and config folders) so Studio can manage pages, not just serve them.

Endpoints

MethodPathDoes
GET/list config folders
POST/{ config } → create a config folder
DELETE/:configdelete a config folder
GET/:configlist page files in a config
GET/:config/:pageread a page (.json parsed, else raw string)
PUT/:config/:page{ content } → create/overwrite a page
DELETE/:config/:pagedelete a page

Every response is { status: 'success', data } or { status: 'error', message } (legacy shape kept).

Usage (in leumas-api)

import { createStaticPagesRouter } from '@leumas/static-pages';
import { requireAuth } from '@leumas/auth';

app.use('/api/static-pages', createStaticPagesRouter({
  base: process.env.STATIC_PAGES_DIR,   // absolute path to the StaticPages root
  gate: requireAuth(),                  // protects create/update/delete; reads stay public
}));

Path traversal is refused — a config can only touch files inside its own folder. Import createStore({ base }) directly if you want the filesystem CRUD without Express.

Source shared/engines/plugins/router-kit/static-pages/README.md (no-git)markdownjson
Generated from the Leumas repository. Every page cites the file it came from.leumas.techllms.txt