Plugin loaders

apiLoaderPlugin

Scan app/api tree mount Hono routes OpenAPI skeleton manicjs/plugins.

apiLoaderPlugin(apiDir?)

import { apiLoaderPlugin } from 'manicjs/plugins';

const { app, routes, openApiSpec } = await apiLoaderPlugin('app/api');

Returns a basePath('/api') Hono instance plus routes string array and minimal openapi JSON.


Behavior

  • Glob *.ts, *.tsx, *.js under apiDir (default app/api).
  • Requires default export — either Hono sub-app (.fetch), or plain handler function.
  • Dynamic dirs [id]:id mount segments.

See the hub page for composition notes: Plugin loaders.


Framework wiring

createManicServer imports this automatically in fullstack mode — production resolves ${dist}/api, development scans app/api.


See also

On this page