Registry / devops / rest-query

rest-query

JSON →
library0.79.8jsnpmunverified

Rest Query is a REST API framework for Node.js (version 0.79.8) focused on querying and manipulating documents via RESTful endpoints. It features hooks for document lifecycle events (beforeCreate, afterCreate, etc.), app lifecycle hooks (init, shutdown), and a powerful query system. Currently in early alpha, it requires Node.js >=22.16.0. Key differentiators include its hook mechanism that allows modifying or interrupting flow, and its focus on document-oriented operations. The framework is actively maintained with noticeable development activity.

npm install rest-query
INSTALL
IMPORT
SIG · REST-QUERY
R
rest-query
devopsjavascriptv0.79.8
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.

createApp
import { createApp } from 'rest-query'
const createApp = require('rest-query')
Package is ESM-only; default export is not available.
HookContext
import type { HookContext } from 'rest-query'
import { HookContext } from 'rest-query'
HookContext is a TypeScript type, not a value.
Schema
import { Schema } from 'rest-query'
const Schema = require('rest-query').Schema
CommonJS require() will not work. Use ESM imports.

Shows how to create a Rest Query app with MongoDB, define a collection, and add a hook for document creation.

import { createApp } from 'rest-query'; import { MongoClient } from 'mongodb'; const mongoClient = new MongoClient('mongodb://localhost:27017'); await mongoClient.connect(); const app = createApp({ database: mongoClient.db('test'), schema: { collections: { users: { hooks: { beforeCreate: async (context) => { context.hook.incomingDocument.createdAt = new Date(); } } } } } }); app.listen(3000, () => console.log('Rest Query server running on port 3000'));
Debug
Known issues
gotchaHooks are async and must return a Promise; the main flow waits for resolution.
fix
Ensure all hook functions are async or return a Promise.
affects: <1.0
gotchaOnly one hook can be registered per event by default; arrays of hooks are supported but called serially.
fix
Use array syntax for multiple hooks: hooks: { beforeCreate: [hook1, hook2] }
affects: <0.80
deprecatedThe 'collections' schema key is deprecated in favor of 'collections' (same name) — no change, but documentation is outdated.
fix
No action needed; naming remains the same.
affects: <0.79
breakingMinimal Node.js version changed from 16 to 22.16.0 in recent versions.
fix
Update Node.js to >=22.16.0.
affects: >=0.78
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/rest-query/index.js from /path/to/your-file.js not supported.
Using require() to import an ESM-only package.
fix
Migrate your project to ESM (add 'type': 'module' to package.json) or use dynamic import().
TypeError: createApp is not a function
Trying to use default import syntax when the package exports named exports only.
fix
Use named import: import { createApp } from 'rest-query'
Node.js version 22.16.0 is required. Current version: 16.14.0.
Running an outdated Node.js version.
fix
Update Node.js to version 22.16.0 or later.
Upgrade
Version history
0.79.8latest on npm
Audit
Dependencies
expressrequiredCore dependency for HTTP server
mongodbrequiredDefault database driver for document storage
Agent activity
4 hits · last 30 days
node
4
Resources
rest-query — npm install rest-query · libregistry