Registry / devops / waibu-rest-api

waibu-rest-api

JSON →
library2.12.0jsnpmunverified

REST API plugin for Waibu Web Framework, built on Fastify. Version 2.12.0 provides a modular RESTful API layer requiring waibu, waibu-db, and bajo-extra as peer dependencies. It integrates tightly with the Bajo ecosystem, offering configuration-driven API endpoints with automatic database binding. Release cadence is irregular; maintained by Ardhi. Differentiator: part of the Bajo framework stack, enabling rapid API development with minimal boilerplate.

npm install waibu-rest-api
INSTALL
IMPORT
SIG · WAIBU-REST-API
W
waibu-rest-api
devopsjavascriptv2.12.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ import waibuRestApi from 'waibu-rest-api'
✗ const waibuRestApi = require('waibu-rest-api')
The package is ESM-only; CommonJS require will fail with ERR_REQUIRE_ESM.
WaibuRestApi
✓ import { WaibuRestApi } from 'waibu-rest-api'
✗ import WaibuRestApi from 'waibu-rest-api'
Named export for the class; default export is the plugin instance.
type PluginConfig
✓ import type { PluginConfig } from 'waibu-rest-api'
TypeScript types are exported alongside runtime code.

Initializes a WaibuRestApi instance with auto-generated routes from database schemas and starts the server.

import { WaibuRestApi } from 'waibu-rest-api' const api = new WaibuRestApi({ prefix: '/api', routes: 'auto', db: process.env.DB_CONNECTION ?? 'sqlite://data.db' }) api.start().then(() => console.log('REST API started'))
Debug
Known issues
breakingAs of v2.0, the package is ESM-only. Attempting to require() it will throw ERR_REQUIRE_ESM.
fix
Convert your project to ESM (use 'import' statements, set 'type': 'module' in package.json, or use dynamic import().
affects: >=2.0.0
gotchaThe 'routes' option expects 'auto' or a path to a route definition file. Misconfiguration yields no endpoints.
fix
Set routes: 'auto' to auto-generate from database schemas.
affects: >=1.0.0
gotchaDatabase connection string must be set via 'db' option or environment variable DB_CONNECTION. No default fallback.
fix
Provide a connection string (e.g., 'sqlite://:memory:') or set DB_CONNECTION in environment.
affects: >=1.0.0
deprecatedMethod 'addRoute' is deprecated in v2.5.0; use 'registerRoute' instead.
fix
Replace addRoute(routeConfig) with registerRoute(routeConfig).
affects: >=2.5.0
breakingOption 'port' renamed to 'listenPort' in v2.3.0.
fix
Rename 'port' to 'listenPort' in configuration.
affects: >=2.3.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM
Using require() on an ESM-only package.
fix
Use import statement or dynamic import().
TypeError: Cannot read properties of undefined (reading 'start')
Instance not properly constructed due to missing required options.
fix
Ensure all required options (prefix, routes, db) are provided.
Error: Cannot find module 'waibu-db'
Peer dependency waibu-db not installed.
fix
Run 'npm install waibu-db'.
Upgrade
Version history
2.12.0latest on npm
Audit
Dependencies
waiburequiredCore web framework required
waibu-dbrequiredDatabase integration for REST endpoints
bajo-extrarequiredExtra utilities for Bajo-based projects
Agent activity
8 hits · last 30 days
node
8
Resources
waibu-rest-api — npm install waibu-rest-api · libregistry