Registry / database / q3-core-rest

q3-core-rest

JSON →
library4.5.18jsnpmunverified

A Mongoose extension that generates RESTful API endpoints for Mongoose schemas automatically. Current stable version is 4.5.18. It uses decorators and configuration to expose CRUD operations (Create, Read, Update, Delete) for Mongoose models with minimal boilerplate. The package also integrates with i18next for localization and is designed to work with Express. It simplifies building REST APIs by providing a standardized way to define routes, permissions, and validation. Release cadence is not specified; it is actively maintained.

npm install q3-core-rest
INSTALL
IMPORT
SIG · Q3-CORE-REST
Q
q3-core-rest
databasejavascriptv4.5.18
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.

q3-core-rest
import q3CoreRest from 'q3-core-rest';
const q3CoreRest = require('q3-core-rest');
Default import recommended for ESM; CommonJS require also works but may have compatibility issues with newer versions.

Shows basic setup: initialize i18next, define a Mongoose model, and attach REST endpoints for that model to an Express app.

import express from 'express'; import mongoose from 'mongoose'; import q3CoreRest from 'q3-core-rest'; import i18next from 'i18next'; // Initialize i18next (required) i18next.init(); // Define a Mongoose schema const userSchema = new mongoose.Schema({ name: { type: String, required: true }, email: { type: String, unique: true }, }); // Create a model const User = mongoose.model('User', userSchema); // Create Express app and connect to MongoDB const app = express(); mongoose.connect('mongodb://localhost:27017/test', { useNewUrlParser: true, useUnifiedTopology: true }); // Apply RESTful routes app.use('/api', q3CoreRest(User)); app.listen(3000);
Debug
Known issues
breakingMongoose v6 is required; v5 not supported.
fix
Upgrade Mongoose to version 6.x or later.
affects: >=4.0
deprecatedThe default export returns a function; do not destructure.
fix
Use default import: import q3CoreRest from 'q3-core-rest';
affects: >=4.0
gotchai18next must be initialized before using q3-core-rest.
fix
Call i18next.init() before importing or using q3CoreRest.
affects: >=4.0
gotchaExpress app must have body-parser or express.json middleware to parse request bodies.
fix
Add app.use(express.json()); before using q3CoreRest.
affects: >=4.0
Errors
Common errors & fixes
Cannot find module 'q3-core-rest'
Package not installed.
fix
npm install q3-core-rest
i18next is not defined
i18next not initialized correctly or not imported.
fix
import i18next from 'i18next'; i18next.init();
CastError: Cast to ObjectId failed for value "..."
Invalid ID in URL parameter.
fix
Ensure the ID parameter is a valid MongoDB ObjectId string.
Upgrade
Version history
4.5.18latest on npm
Audit
Dependencies
expressrequiredRequired to set up REST routes and middleware for HTTP handling.
i18nextrequiredUsed for internationalization of response messages and error strings.
mongooserequiredCore dependency for defining and interacting with MongoDB schemas.
Agent activity
6 hits · last 30 days
node
6
Resources
q3-core-rest — npm install q3-core-rest · libregistry