Gathering detailed insights and metrics for node-easy-crud
Gathering detailed insights and metrics for node-easy-crud
Gathering detailed insights and metrics for node-easy-crud
Gathering detailed insights and metrics for node-easy-crud
react-node-easy-crud
create crud table in react which can work flowlessly with node-easy-crud
easy-express-crud-generator
Rest apis generator for node, express app
node-pg-crud
Easy-to-use PostgreSQL CRUD Handlers + Utilities
em-crud
'Express Mongoose CRUD' Simplify CRUD operations for Mongoose models in Node.js with advanced features.
this package is ment to make creating CRUD application for your node express mongo environment easy
npm install node-easy-crud
Typescript
Module System
Node Version
NPM Version
TypeScript (80.3%)
JavaScript (19.7%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
6 Stars
18 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Jun 20, 2025
Latest Version
1.0.4
Package Id
node-easy-crud@1.0.4
Unpacked Size
39.21 kB
Size
8.10 kB
File Count
6
NPM Version
6.14.6
Node Version
12.18.3
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
This package is ment to make creating CRUD application for your node express mongo environment easy. Light Weight with Zero Dependency
now build with TypeScript since version 1.0.4
It will Create API endpoints for Adding, Reading, Updating, Deleting form given mongoDB collection. you just simply have to provide a mongoose model to the constructor. It also provides form structure for frontend so that one can create a edit or add action forms easliy
a basic React component pacakge react-node-easy-crud is created to make quick curd UI for node-easy-crud. *I need help for creating a front end packages for Anguler, Vui, and React which will run greate with node-easy-crud*.
npm install node-easy-crud
you can simply create a crud api for mongoDB collection with following(Subject is mongoose model and router is express router):
1new CURD(Subject, router);
1const CURD = require("node-easy-crud"); 2const express = require("express"); 3const router = express.Router(); 4 5const Subject = require("../models/Subject"); //mongoose model 6 7//to create CRUD routes for Subject model Simply use following code: 8new CURD(Subject, router); 9 10module.exports = router;
GET <express-router-url>/<mongoose model name>
in our example mongoose model name is Subject so read endpoint is:
GET <express-router-url>/Subject
this endpoint will be provided form structure for add action form
GET <express-router-url>/Subject/add-form
this endpoint will be provided for inserting a new document, you should provide the data to be inserted as JSON in request body.
POST <express-router-url>/Subject/insert
this endpoint will be provided form structure and values of document to be edited, takes id of the document to be edited as paramenter
GET <express-router-url>/Subject/edit-form/:id
this endpoint will be provided for updating a document, you should provide the data to be updated as JSON in request body. Data must contain id of document to be updated
POST <express-router-url>/Subject/update
You can also pass options as object as 3rd argumnt to the constructor to customize
this example shows how to use options
1const CURD = require("node-easy-crud");
2const express = require("express");
3const router = express.Router();
4
5const Subject = require("../models/Subject"); //mongoose model
6const User = require("../models/User");
7
8//to create CRUD routes for User model Simply use following code:
9new CURD(Subject, router, {
10 fields: ["name", "sem", "creator", "date"], // only select given fields for all CRUD oprations
11 ref: { creator: { model: User, field: "name" } }, //replace value of creator field with value on given field i.e "name" from refrenced model
12 route: "Subject", //will change route from default value model name to given value
13});
14module.exports = router;
name | default | data type | description |
---|---|---|---|
idField | _id | string | set id field name of the model |
route | modelname | string | set base route for crud endpoints |
ref | null | object | set reference to another model and display field from another model in the place reference id. ex: ref :{ creator: { model: User, field: "name" } }, |
unsetAdd | false | boolean | set true to disable add on model |
unsetEdit | false | boolean | set true to disable edit on model |
unsetDelete | false | boolean | set true to disable delete on model |
fields | all fields in model | array | use to select specific fields while reading ex:fields: ["name", "sem", "creator", "topics"] |
addFields | fields | array | use to select specific fields while inserting |
editFields | fields | array | use to select specific fields while editing |
callbackBeforeRead | Undefined | function | use to add callback function to call before reading |
callbackBeforeDelete | Undefined | function | use to add callback function to call before deleting |
callbackBeforeUpdate | Undefined | function | use to add callback function to call before updating |
callbackBeforeInsert | Undefined | function | use to add callback function to call before inserting |
callbackAfterRead | Undefined | function | use to add callback function to call after reading |
callbackAfterDelete | Undefined | function | use to add callback function to call after deleting |
callbackAfterUpdate | Undefined | function | use to add callback function to call after updating |
callbackAfterInsert | Undefined | function | use to add callback function to call after inserting |
you can add callback functions after or before every CRUD opration, you can pass callback funtions in options while creating object. example below show how to add call back funtions before and after read opration:
1const BeforeRead = () => { 2 console.log("starting to read data"); 3}; 4const AfterRead = (data) => { 5 console.log(data); 6}; 7 8//New CRUD(Model,Router,Options) 9new CURD(Subject, router, { 10 fields: ["name", "sem", "creator", "date"], 11 ref: { creator: { model: User, field: "name" } }, 12 route: "Subject", //Default value model name 13 callbackBeforeRead: BeforeRead, 14 callbackAfterRead: AfterRead, 15});
you can pass a function in callbackBeforeRead. this function will run before reading the data. function you passed to callbackBeforeRead should not have any arguments required and does not need to return anything.
1const BeforeRead = () => { 2 console.log("starting to read data"); 3}; 4 5//New CRUD(Model,Router,Options) 6new CURD(Subject, router, { 7 callbackBeforeRead: BeforeRead, 8});
callbackBeforeRead does not need to return anything but however if you want to stop reading in callbackBeforeRead you can return a error message and then node-easy-crud will not read and return data
1const BeforeRead = () => { 2 console.log("starting to read data"); 3 return { errorFromCallback: "you can not read this data" }; 4}; 5 6//New CRUD(Model,Router,Options) 7new CURD(Subject, router, { 8 callbackBeforeRead: BeforeRead, 9});
if you return errorFromCallback in callbackBeforeRead node-easy-crud will not read data and return the error in responce as following:
1{ error: errorFromCallback }
you can pass a function in callbackBeforeDelete. this function will run before deleting a document from collection. function you passed to callbackBeforeDelete will recive request body containing id of document to be delated and does need to return reqest body.
1const BeforeDelete = (body) => { 2 console.log("deleting row with id:" + body.id); 3 return body; //returning body is required 4}; 5 6//New CRUD(Model,Router,Options) 7new CURD(Subject, router, { 8 callbackBeforeDelete: BeforeDelete, 9});
you can pass a function in callbackBeforeUpdate. this function will run before updating a document from collection. function you passed to callbackBeforeUpdate will recive request body containing document to be updated and does need to return reqest body.
1const BeforeUpdate = (body) => { 2 console.log("updating row with id:" + body.id); 3 body.name = body.name.toUpperCase(); //changing the name to uppercase just for example 4 return body; //returning body is required 5}; 6 7//New CRUD(Model,Router,Options) 8new CURD(Subject, router, { 9 callbackBeforeUpdate: BeforeUpdate, 10});
you can pass a function in callbackBeforeInsert. this function will run before inserting a document to collection. function you passed to callbackBeforeInsert will recive request body containing document to be added and does need to return reqest body.
1const BeforeInsert = (body) => { 2 console.log("inserting new row"); 3 body.name = body.name.toUpperCase(); //changing the name to uppercase just for example 4 return body; //returning body is required 5}; 6 7//New CRUD(Model,Router,Options) 8new CURD(Subject, router, { 9 callbackBeforeInsert: BeforeInsert, 10});
To stop insert,update or delete opration in before call back, add errorFromCallback to body object and return it. then node-easy-crud will not perfore opration and only send error in responce
1const BeforeDelete = (body) => { 2 body.errorFromCallback = "you dont have permission to delete this object"; 3 return body; 4}; 5//New CRUD(Model,Router,Options) 6new CURD(Subject, router, { 7 callbackBeforeDelete: BeforeDelete, 8});
to add custome success message add messageFromCallback to body before returning it in any callbackBefore other than callbackBeforeRead.
1const BeforeDelete = (body) => { 2 body.messageFromCallback = "Just Trashed subject with id:" + body.id; 3 return body; 4}; 5//New CRUD(Model,Router,Options) 6new CURD(Subject, router, { 7 callbackBeforeDelete: BeforeDelete, 8});
you can pass a function in callbackAfterRead. this function will run after reading the data. function you passed to callbackAfterRead will recive data read form the given collection.
1const AfterRead = (data) => { 2 console.log(data); 3}; 4 5//New CRUD(Model,Router,Options) 6new CURD(Subject, router, { 7 callbackAfterRead: AfterRead, 8});
you can pass a function in callbackAfterDelete. this function will run after deleting a document. function you passed to callbackAfterDelete will recive object return by mongoose after deleting the document.
1const AfterDelete = (deleted) => { 2 console.log(deleted); 3}; 4 5//New CRUD(Model,Router,Options) 6new CURD(Subject, router, { 7 callbackAfterDelete: AfterDelete, 8});
you can pass a function in callbackAfterUpdate. this function will run after updating a document. function you passed to callbackAfterUpdate will recive updated document as a argument.
1const AfterUpdate = (updatedRow) => { 2 console.log(updatedRow); 3}; 4 5//New CRUD(Model,Router,Options) 6new CURD(Subject, router, { 7 callbackAfterUpdate: AfterUpdate, 8});
you can pass a function in callbackAfterInsert. this function will run after inserting new document. function you passed to callbackAfterInsert will recive new document as a argument.
1const AfterInsert = (newRow) => { 2 console.log(newRow); 3}; 4 5//New CRUD(Model,Router,Options) 6new CURD(Subject, router, { 7 callbackAfterInsert: AfterInsert, 8});
Email me: shashank23padwal@live.com
linkedIn: Shashank Padwal
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 0/18 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
17 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More