Gathering detailed insights and metrics for easy-express-crud-generator
Gathering detailed insights and metrics for easy-express-crud-generator
Gathering detailed insights and metrics for easy-express-crud-generator
Gathering detailed insights and metrics for easy-express-crud-generator
npm install easy-express-crud-generator
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
9 Stars
31 Commits
5 Forks
1 Watchers
1 Branches
1 Contributors
Updated on Sep 12, 2023
Latest Version
1.4.9
Package Id
easy-express-crud-generator@1.4.9
Unpacked Size
29.22 kB
Size
9.00 kB
File Count
14
NPM Version
6.10.3
Node Version
10.16.0
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
5
Simple express, mongoose based crud api generator
.
You should have express app ready with mongoose and body-parser setup properly.
Apart from that must read minimal setup below before using it.
Detailed Documentation and example app will be added shortly!
Query is case sensitive. All mentioned params and query stirngs are expected in lowercase.
/city
will fetch all records with all data./city/name/country
you will get _id, name and country only. Nothing else.eq, ne, lt, gt, lte, gte, in, nin, contains, ncontains, containss, ncontainss
Add any of the above mentioned keywords to apply filters.
/city/name?name_eq=ambala
will bring only the results where name is equal to ambala
Rest of the keywords work as follows
/city/name?name_eq=ambala
/city/name?name_ne=ambala
/city?name_in=ambala&name_in=mumbai&name_in=banglore
/city?name_nin=ambala&name_nin=mumbai&name_nin=banglore
/city/name?name_contains=ambala
/city/name?name_ncontains=ambala
/city/name?name_containss=ambala
/city/name?name_ncontainss=ambala
_skip, _limit, _sort, asc, desc
n
numbers of records
/city/name?_skip=10
n
numbers or records (combine with _skip for pagination)
/city/name?_limit=10
asc || desc
/city/name?name_sort:asc
/city/name?name_sort:desc
/city/name/_country.name/_country.shortCode
. We will get following response./city?_id=5d303bf55c05844dcfabf897
1{ 2 "status": true, 3 "data": [ 4 { 5 "_id": "5d303bf55c05844dcfabf897", 6 "name": "ambala", 7 "_country": { 8 "_id": "5d303bc65c05844dcfabf895", 9 "name": "india" 10 } 11 } 12 ], 13 "count": 1 14}
1const bodyParser = require('body-parser'); 2const CRUD = require('easy-express-crud-generator'); 3const express = require('express'); 4const mongoose = require('mongoose'); 5 6// DB connection 7mongoose.set('useNewUrlParser', true); 8mongoose.set('useFindAndModify', false); 9mongoose.set('useCreateIndex', true); 10mongoose.connect('mongodb://localhost:27017/dbName', (err) => { 11 if (err) throw err; 12 console.log('DB connected successfully!'); 13}); 14mongoose.Promise = global.Promise; 15 16// Moongoose model define 17const countrySchema = new mongoose.Schema({ 18 name: String, 19 shortCode: String, 20}, { timestamps: true }); 21const CountryModel = mongoose.model('Country', countrySchema); 22 23const citySchema = new mongoose.Schema({ 24 _country: { type: mongoose.Schema.Types.ObjectId, ref: 'Country' }, 25 name: String, 26}, { timestamps: true }); 27const CityModel = mongoose.model('City', citySchema); 28 29// Creating crud operations 30const cityRouter = new CRUD(CityModel).getRouter(express.Router()); 31const countryRouter = new CRUD(CountryModel).getRouter(express.Router()); 32 33// Basic express app setup 34const app = express(); 35app.use(bodyParser.json()); 36app.listen(3000); 37 38// Custom error handler (optional) 39app.use((req, res, next) => { 40 req.errorHandler = (err) => { 41 return res.send({ status: false, message: 'Something went wrong' }); 42 } 43 next(); 44}); 45 46const apiRouter = express.Router(); 47 48apiRouter.use('/city', cityRouter); 49apiRouter.use('/country', countryRouter); 50 51app.use(apiRouter);
Above example will create four endpoints for every mongoose schema.
including search, filter, pagination, populate
_id shall be passed in body
_id shall be passed in body
This is not the roboust library with lot's of functionalities. I just tried to do my best. I need your support to make it better. You can join me by forking the repo or sending your suggestions, comments etc.
I really hope my these small efforts may bring some help in your project.
Thank you :pray:
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
Found 0/30 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 effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
52 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