Skip to content

basalt / generator/src / registerResourceInApp

Function: registerResourceInApp() ​

> registerResourceInApp(name, options?): Promise<AppRegistration>

Defined in: generator/src/generate.ts:206

Wires a generated resource into src/app.ts: imports the plugin + routes, adds the plugin to the plugins array and spreads the routes into fastifyPlugin({ routes: [...] }).

Best-effort and idempotent: if app.ts is missing, already wired, or does not match the expected shape, it changes nothing and reports why — so the caller can fall back to printing manual instructions. Never throws on shape.

Parameters ​

name ​

string

options? ​

WriteOptions = {}

Returns ​

Promise<AppRegistration>

Released under the MIT License.