express-rest-api-generator
Advanced tools
Comparing version 1.3.1 to 1.3.2
@@ -29,3 +29,3 @@ const bodyParser = require('body-parser'); | ||
// used by `mutatePrivateKeys`, looks onto the model for | ||
// used by `removePrivateKeys`, looks onto the model for | ||
// a static with provided key | ||
@@ -48,4 +48,4 @@ if (!this.privatesKey) this.privatesKey = 'privateKeys'; | ||
const route = slugify(key); | ||
const url = `${this.path}/${route}/:id?`; | ||
router.use( | ||
const url = `/${route}/:id?`; | ||
router.route(this.path).use( | ||
url, | ||
@@ -57,3 +57,3 @@ bodyParser.json(), | ||
this.mutators, | ||
this.mutatePrivateKeys, | ||
this.removePrivateKeys, | ||
this.endpoint | ||
@@ -83,3 +83,3 @@ ); | ||
// mutates query to hide private keys | ||
this.mutatePrivateKeys = function(req, res, next) { | ||
this.removePrivateKeys = function(req, res, next) { | ||
if (!req[this.key].length) return next(); | ||
@@ -145,5 +145,4 @@ const keys = Array.isArray(this.model[this.privatesKey]) | ||
Rest.prototype.mount = function(app) { | ||
const url = `${this.path}/:id?`; | ||
app.use( | ||
url, | ||
app.route(this.path).use( | ||
'/:id?', | ||
bodyParser.json(), | ||
@@ -154,3 +153,3 @@ this.initializer, | ||
this.mutators, | ||
this.mutatePrivateKeys, | ||
this.removePrivateKeys, | ||
this.endpoint | ||
@@ -157,0 +156,0 @@ ); |
{ | ||
"name": "express-rest-api-generator", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "express mountable app for mongoose routes with generators for mongoose model embedded statics", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9051
257