express-restify-mongoose 7.0.2 → 9.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,44 +1,7 @@
1
1
  {
2
- "version": "7.0.2",
3
- "author": {
4
- "email": "flo.holzapfel@gmail.com",
5
- "name": "Florian Holzapfel"
6
- },
7
- "dependencies": {
8
- "ensure-array": "~1.0.0",
9
- "is-coordinates": "~2.0.0",
10
- "lodash.defaults": "~4.2.0",
11
- "lodash.get": "~4.4.2",
12
- "lodash.has": "~4.5.2",
13
- "lodash.isplainobject": "~4.0.6",
14
- "mongoose-detective": "~2.0.0",
15
- "moredots": "~1.0.1",
16
- "run-series": "~1.1.8",
17
- "serialize-error": "^7.0.1",
18
- "weedout": "~1.0.1"
19
- },
20
- "peerDependencies": {
21
- "mongoose": "6.x"
22
- },
2
+ "name": "express-restify-mongoose",
3
+ "version": "9.0.1",
23
4
  "description": "Easily create a flexible REST interface for mongoose models",
24
- "devDependencies": {
25
- "body-parser": "^1.19.0",
26
- "eslint": "^7.4.0",
27
- "eslint-config-prettier": "^6.11.0",
28
- "eslint-plugin-prettier": "^3.1.4",
29
- "express": "^4.17.1",
30
- "in-publish": "^2.0.1",
31
- "method-override": "^3.0.0",
32
- "mocha": "^10.1.0",
33
- "prettier": "^2.0.5",
34
- "request": "^2.88.2",
35
- "restify": "^8.5.1",
36
- "sinon": "^9.0.2"
37
- },
38
- "engines": {
39
- "node": ">=14"
40
- },
41
- "homepage": "http://florianholzapfel.github.io/express-restify-mongoose/",
42
5
  "keywords": [
43
6
  "ReST",
44
7
  "express",
@@ -47,34 +10,65 @@
47
10
  "mongoose",
48
11
  "model"
49
12
  ],
50
- "license": "MIT",
51
- "main": "./src/express-restify-mongoose",
52
- "name": "express-restify-mongoose",
53
- "readmeFilename": "README.md",
13
+ "homepage": "http://florianholzapfel.github.io/express-restify-mongoose/",
14
+ "bugs": {
15
+ "url": "https://github.com/florianholzapfel/express-restify-mongoose/issues"
16
+ },
54
17
  "repository": {
55
18
  "type": "git",
56
19
  "url": "git://github.com/florianholzapfel/express-restify-mongoose.git"
57
20
  },
58
- "bugs": {
59
- "url": "https://github.com/florianholzapfel/express-restify-mongoose/issues"
21
+ "license": "MIT",
22
+ "author": {
23
+ "name": "Florian Holzapfel",
24
+ "email": "flo.holzapfel@gmail.com"
60
25
  },
26
+ "main": "./dist/express-restify-mongoose.js",
27
+ "files": [
28
+ "dist/"
29
+ ],
61
30
  "scripts": {
62
- "lint": "eslint . --ext .js",
63
- "prepublish": "in-publish && npm test || not-in-publish",
64
- "pretest": "npm run lint",
65
- "test": "npm run test-unit && npm run test-filter && npm run test-express && npm run test-restify",
66
- "test-ci": "npm run test-unit && npm run test-filter && npm run test-restify",
67
- "test-unit": "mocha -R spec ./test/unit.js",
68
- "test-filter": "mocha -R spec ./test/integration/resource_filter.js --timeout 10s",
69
- "test-express": "mocha -R spec ./test/express.js --timeout 10s",
70
- "test-restify": "mocha -R spec ./test/restify.js --timeout 10s"
31
+ "build": "run-p build:*",
32
+ "build:cjs": "swc src --config module.type=commonjs --out-dir dist",
33
+ "build:dts": "tsup src/express-restify-mongoose.ts --dts-only",
34
+ "lint": "eslint . --ext .js,.ts",
35
+ "test": "run-s test:*",
36
+ "test:express": "mocha -R spec ./test/express.mjs --timeout 10s",
37
+ "test:filter": "mocha -R spec ./test/integration/resource_filter.mjs --timeout 10s",
38
+ "test:restify": "mocha -R spec ./test/restify.mjs --timeout 10s",
39
+ "test:unit": "mocha -R spec ./test/unit.mjs",
40
+ "tsc": "tsc --noEmit"
71
41
  },
72
- "types": "./index.d.ts",
73
- "files": [
74
- "CHANGELOG.md",
75
- "LICENSE",
76
- "README.md",
77
- "index.d.ts",
78
- "src/"
79
- ]
80
- }
42
+ "dependencies": {
43
+ "dot-prop": "^6.0.0",
44
+ "lodash.isplainobject": "~4.0.6",
45
+ "mongoose": "^8.2.1",
46
+ "serialize-error": "^8.1.0",
47
+ "zod": "^3.19.1"
48
+ },
49
+ "devDependencies": {
50
+ "@swc/cli": "^0.1.57",
51
+ "@swc/core": "^1.3.17",
52
+ "@swc/register": "^0.1.10",
53
+ "@types/express": "^4.17.14",
54
+ "@typescript-eslint/eslint-plugin": "^5.40.0",
55
+ "@typescript-eslint/parser": "^5.40.0",
56
+ "body-parser": "^1.19.0",
57
+ "esbuild": "^0.15.12",
58
+ "eslint": "^8.25.0",
59
+ "eslint-plugin-mocha": "10.3.0",
60
+ "express": "^4.17.1",
61
+ "method-override": "^3.0.0",
62
+ "mocha": "^10.1.0",
63
+ "npm-run-all": "^4.1.5",
64
+ "prettier": "^2.7.1",
65
+ "request": "^2.88.2",
66
+ "restify": "^4.3.4",
67
+ "sinon": "^14.0.1",
68
+ "tsup": "^6.3.0",
69
+ "typescript": "^4.8.4"
70
+ },
71
+ "engines": {
72
+ "node": ">=16"
73
+ }
74
+ }
package/CHANGELOG.md DELETED
@@ -1,92 +0,0 @@
1
- Changelog
2
- =========
3
-
4
- ### 6.0.0
5
- > **This release requires mongoose ~5.8**
6
-
7
- * updated mongoose to version 5.8
8
-
9
- ### 5.0.0
10
-
11
- * dropped support for Node 4 and added support for Node 10
12
- * removed query operator parsing [#285](https://github.com/florianholzapfel/express-restify-mongoose/issues/285)
13
- * moved request query in req.erm.query [#299](https://github.com/florianholzapfel/express-restify-mongoose/issues/299) [#353](https://github.com/florianholzapfel/express-restify-mongoose/issues/353)
14
- * removed `next` from postProcess [#334](https://github.com/florianholzapfel/express-restify-mongoose/issues/334)
15
- * added error when skip and/or limit is not a valid integer
16
- * removed `_id` tinkering [#326](https://github.com/florianholzapfel/express-restify-mongoose/issues/326)
17
- * removed dependency on `async`
18
-
19
- ### 4.3.0
20
-
21
- * added support for async `outputFn` by returning a Promise
22
-
23
- ### 4.2.2
24
-
25
- * removed dependency on `lodash`, use specific modules and native methods when possible [#352](https://github.com/florianholzapfel/express-restify-mongoose/pull/352)
26
-
27
- ### 4.2.1
28
-
29
- * fixed issue [#294](https://github.com/florianholzapfel/express-restify-mongoose/issues/294)
30
-
31
- ### 4.2.0
32
-
33
- * removed `compile` step, code now runs natively on Node 4+ and `babel` is only used for coverage
34
-
35
- ### 4.1.1
36
-
37
- * fixed `distinct` queries when `options.totalCountHeader` is enabled
38
-
39
- ### 4.1.0
40
-
41
- * improved sync error handling in `buildQuery` by wrapping in a promise
42
- * fixed crash when `distinct` and `sort` operators were used in the same query
43
-
44
- ### 4.0.0
45
-
46
- * improved default error middleware by serializing error objects and removing stack traces
47
- * fixed Mongoose async middleware error propagation
48
- * fixed requests to always set `req.erm.statusCode`
49
- * removed `statusCode` from error object and response body
50
- * removed undocumented `outputFn` parameter, use `req.erm.result` and `req.erm.statusCode`
51
-
52
- ### 3.2.0
53
-
54
- * added an option to disable regex operations ([#195](https://github.com/florianholzapfel/express-restify-mongoose/issues/195))
55
- * fixed queries with an `idProperty` resulting in a `CastError` to return `404` instead of `400` ([#184](https://github.com/florianholzapfel/express-restify-mongoose/issues/184))
56
- * fixed query parser to handle geospatial operators ([#187](https://github.com/florianholzapfel/express-restify-mongoose/issues/187))
57
-
58
- ### 3.1.0
59
-
60
- * critical security fix with the `distinct` operator, see [issue #252](https://github.com/florianholzapfel/express-restify-mongoose/issues/252) for details
61
-
62
- ### 3.0.0
63
-
64
- * ported source to ES2015, compiled and published as ES5 with Babel
65
- * document filtering is now done right before output allowing access to the full document in post middleware
66
- * removed `options.lowercase` and `options.plural`, use `options.name = require('inflection').pluralize('modelName').toLowerCase()`
67
-
68
- ### 2.0.0
69
-
70
- * changed `serve` to no longer returns an Express 4 router, now returns the resource's base path (ie.: `/api/v1/Customer`)
71
- * changed `options.private` and `options.protected` to no longer accept comma separated fields, pass an array instead
72
- * removed `options.excluded`, use `options.private`
73
- * removed support for querying directly with query parameters, use `url?query={"name":"hello"}`
74
- * removed $and and $or query parameters, use `url?query={"$or":[...]}`
75
- * removed `prereq`, use `preMiddleware` instead
76
- * changed `postCreate`, `postUpdate`, and `postDelete` signatures to `(req, res, next)`
77
- * deprecated `outputFn`'s `data` parameter, data now available on `req.erm.result` and `req.erm.statusCode`
78
-
79
- ### 1.0.0
80
-
81
- > **This release requires mongoose ~4**
82
-
83
- * updated mongoose to version 4
84
- * removed `fullErrors`, implement a custom `onError` handler instead
85
- * removed `strict` option, allows DELETE without id and POST with id, disallows PUT without id
86
- * async `prereq` and `access` now use the standard `(err, data)` callback signature
87
- * `access` will throw an exception when an unsupported value is passed
88
- * changed `outputFn`'s signature to: `(req, res, { result: result, statusCode: statusCode })`
89
-
90
- ### 0.7.0
91
-
92
- > **This release requires mongoose ~3**
package/index.d.ts DELETED
@@ -1,45 +0,0 @@
1
- // Type definitions for express-restify-mongoose 3.2.0
2
- // Project: https://github.com/florianholzapfel/express-restify-mongoose
3
- // Definitions by: pedroraft <https://github.com/pedroraft> & ravishivt <https://github.com/ravishivt>
4
- // Definitions: https://github.com/florianholzapfel/express-restify-mongoose
5
- // TypeScript Version: 2.5.3
6
-
7
- ///<reference types="express" />
8
- ///<reference types="mongoose" />
9
-
10
- // DOCS: https://florianholzapfel.github.io/express-restify-mongoose/
11
- declare module 'express-restify-mongoose' {
12
- import * as express from 'express';
13
- import * as mongoose from 'mongoose';
14
-
15
- export interface Options {
16
- prefix?: string;
17
- version?: string;
18
- idProperty?: string;
19
- restify?: boolean;
20
- plural?: boolean;
21
- lowercase?: boolean;
22
- name?: string;
23
- private?: string[];
24
- protected?: string[];
25
- lean?: boolean;
26
- findOneAndUpdate?: boolean;
27
- preMiddleware?: (req: express.Request, res: express.Response, next: express.NextFunction) => any;
28
- preCreate?: (req: express.Request, res: express.Response, next: express.NextFunction) => any;
29
- preRead?: (req: express.Request, res: express.Response, next: express.NextFunction) => any;
30
- preUpdate?: (req: express.Request, res: express.Response, next: express.NextFunction) => any;
31
- preDelete?: (req: express.Request, res: express.Response, next: express.NextFunction) => any;
32
- access?: (req: express.Request, done?: any) => any;
33
- contextFilter?: (model: mongoose.Model<any>, req: express.Request, done: any) => any;
34
- postCreate?: (req: express.Request, res: express.Response, next: express.NextFunction) => any;
35
- postRead?: (req: express.Request, res: express.Response, next: express.NextFunction) => any;
36
- postUpdate?: (req: express.Request, res: express.Response, next: express.NextFunction) => any;
37
- postDelete?: (req: express.Request, res: express.Response, next: express.NextFunction) => any;
38
- outputFn?: (req: express.Request, res: express.Response) => any;
39
- onError?: (err: any, req: express.Request, res: express.Response, next: express.NextFunction) => any;
40
- }
41
-
42
- export function serve(router: express.Router, mongooseModel: mongoose.Model<any>, options?: Options): string;
43
-
44
- export function defaults(options: Options): void;
45
- }
package/src/buildQuery.js DELETED
@@ -1,55 +0,0 @@
1
- 'use strict'
2
-
3
- module.exports = function (options) {
4
- return function (query, queryOptions) {
5
- const promise = new Promise((resolve, reject) => {
6
- if (!queryOptions) {
7
- return resolve(query)
8
- }
9
-
10
- if (queryOptions.query) {
11
- query.where(queryOptions.query)
12
- }
13
-
14
- if (queryOptions.skip) {
15
- query.skip(queryOptions.skip)
16
- }
17
-
18
- if (options.limit && (!queryOptions.limit || queryOptions.limit === '0' || queryOptions.limit > options.limit)) {
19
- queryOptions.limit = options.limit
20
- }
21
-
22
- if (queryOptions.limit && query.op !== 'count' && !queryOptions.distinct) {
23
- query.limit(queryOptions.limit)
24
- }
25
-
26
- if (queryOptions.sort) {
27
- query.sort(queryOptions.sort)
28
- }
29
-
30
- if (queryOptions.populate) {
31
- query.populate(queryOptions.populate)
32
- }
33
-
34
- if (queryOptions.select) {
35
- query.select(queryOptions.select)
36
- }
37
-
38
- if (queryOptions.distinct) {
39
- query.distinct(queryOptions.distinct)
40
- }
41
-
42
- if (options.readPreference) {
43
- query.read(options.readPreference)
44
- }
45
-
46
- if (options.lean) {
47
- query.lean(options.lean)
48
- }
49
-
50
- resolve(query)
51
- })
52
-
53
- return promise
54
- }
55
- }
@@ -1,17 +0,0 @@
1
- 'use strict'
2
-
3
- const http = require('http')
4
-
5
- module.exports = function (options) {
6
- return function (req, res, next) {
7
- return function (err) {
8
- if (err.message === http.STATUS_CODES[404] || (req.params.id && err.path === options.idProperty && err.name === 'CastError')) {
9
- req.erm.statusCode = 404
10
- } else {
11
- req.erm.statusCode = req.erm.statusCode && req.erm.statusCode >= 400 ? req.erm.statusCode : 400
12
- }
13
-
14
- options.onError(err, req, res, next)
15
- }
16
- }
17
- }
@@ -1,144 +0,0 @@
1
- 'use strict'
2
-
3
- const defaults = require('lodash.defaults')
4
- const ensureArray = require('ensure-array')
5
- const util = require('util')
6
- const Filter = require('./resource_filter')
7
- let customDefaults = null
8
- const excludedMap = {}
9
-
10
- function getDefaults() {
11
- return defaults(Object.assign({}, customDefaults), {
12
- prefix: '/api',
13
- version: '/v1',
14
- idProperty: '_id',
15
- findOneAndUpdate: true,
16
- findOneAndRemove: true,
17
- lean: true,
18
- restify: false,
19
- runValidators: false,
20
- allowRegex: true,
21
- private: [],
22
- protected: [],
23
- upsert: false,
24
- })
25
- }
26
-
27
- const restify = function (app, model, opts) {
28
- const options = Object.assign({}, getDefaults(), opts || {})
29
-
30
- const access = require('./middleware/access')
31
- const ensureContentType = require('./middleware/ensureContentType')(options)
32
- const filterAndFindById = require('./middleware/filterAndFindById')(model, options)
33
- const onError = require('./middleware/onError')
34
- const outputFn = require('./middleware/outputFn')
35
- const prepareQuery = require('./middleware/prepareQuery')(options)
36
- const prepareOutput = require('./middleware/prepareOutput')(options, excludedMap)
37
-
38
- if (!Array.isArray(options.private)) {
39
- throw new Error('"options.private" must be an array of fields')
40
- }
41
-
42
- if (!Array.isArray(options.protected)) {
43
- throw new Error('"options.protected" must be an array of fields')
44
- }
45
-
46
- model.schema.eachPath((name, path) => {
47
- if (path.options.access) {
48
- switch (path.options.access.toLowerCase()) {
49
- case 'private':
50
- options.private.push(name)
51
- break
52
- case 'protected':
53
- options.protected.push(name)
54
- break
55
- }
56
- }
57
- })
58
-
59
- options.filter = new Filter({
60
- model,
61
- excludedMap,
62
- filteredKeys: {
63
- private: options.private,
64
- protected: options.protected,
65
- },
66
- })
67
-
68
- excludedMap[model.modelName] = options.filter.filteredKeys
69
-
70
- options.preMiddleware = ensureArray(options.preMiddleware)
71
- options.preCreate = ensureArray(options.preCreate)
72
- options.preRead = ensureArray(options.preRead)
73
- options.preUpdate = ensureArray(options.preUpdate)
74
- options.preDelete = ensureArray(options.preDelete)
75
-
76
- if (!options.contextFilter) {
77
- options.contextFilter = (model, req, done) => done(model)
78
- }
79
-
80
- options.postCreate = ensureArray(options.postCreate)
81
- options.postRead = ensureArray(options.postRead)
82
- options.postUpdate = ensureArray(options.postUpdate)
83
- options.postDelete = ensureArray(options.postDelete)
84
-
85
- if (!options.onError) {
86
- options.onError = onError(!options.restify)
87
- }
88
-
89
- if (!options.outputFn) {
90
- options.outputFn = outputFn(!options.restify)
91
- }
92
-
93
- options.name = options.name || model.modelName
94
-
95
- const ops = require('./operations')(model, options, excludedMap)
96
-
97
- let uriItem = `${options.prefix}${options.version}/${options.name}`
98
- if (uriItem.indexOf('/:id') === -1) {
99
- uriItem += '/:id'
100
- }
101
-
102
- const uriItems = uriItem.replace('/:id', '')
103
- const uriCount = uriItems + '/count'
104
- const uriShallow = uriItem + '/shallow'
105
-
106
- if (typeof app.delete === 'undefined') {
107
- app.delete = app.del
108
- }
109
-
110
- app.use((req, res, next) => {
111
- const getModel = options.modelFactory && options.modelFactory.getModel
112
-
113
- req.erm = {
114
- model: typeof getModel === 'function' ? getModel(req) : model,
115
- }
116
-
117
- next()
118
- })
119
-
120
- const accessMiddleware = options.access ? access(options) : []
121
-
122
- app.get(uriItems, prepareQuery, options.preMiddleware, options.preRead, accessMiddleware, ops.getItems, prepareOutput)
123
- app.get(uriCount, prepareQuery, options.preMiddleware, options.preRead, accessMiddleware, ops.getCount, prepareOutput)
124
- app.get(uriItem, prepareQuery, options.preMiddleware, options.preRead, accessMiddleware, ops.getItem, prepareOutput)
125
- app.get(uriShallow, prepareQuery, options.preMiddleware, options.preRead, accessMiddleware, ops.getShallow, prepareOutput)
126
-
127
- app.post(uriItems, prepareQuery, ensureContentType, options.preMiddleware, options.preCreate, accessMiddleware, ops.createObject, prepareOutput)
128
- app.post(uriItem, util.deprecate(prepareQuery, 'express-restify-mongoose: in a future major version, the POST method to update resources will be removed. Use PATCH instead.'), ensureContentType, options.preMiddleware, options.findOneAndUpdate ? [] : filterAndFindById, options.preUpdate, accessMiddleware, ops.modifyObject, prepareOutput)
129
-
130
- app.put(uriItem, util.deprecate(prepareQuery, 'express-restify-mongoose: in a future major version, the PUT method will replace rather than update a resource. Use PATCH instead.'), ensureContentType, options.preMiddleware, options.findOneAndUpdate ? [] : filterAndFindById, options.preUpdate, accessMiddleware, ops.modifyObject, prepareOutput)
131
- app.patch(uriItem, prepareQuery, ensureContentType, options.preMiddleware, options.findOneAndUpdate ? [] : filterAndFindById, options.preUpdate, accessMiddleware, ops.modifyObject, prepareOutput)
132
-
133
- app.delete(uriItems, prepareQuery, options.preMiddleware, options.preDelete, ops.deleteItems, prepareOutput)
134
- app.delete(uriItem, prepareQuery, options.preMiddleware, options.findOneAndRemove ? [] : filterAndFindById, options.preDelete, ops.deleteItem, prepareOutput)
135
-
136
- return uriItems
137
- }
138
-
139
- module.exports = {
140
- defaults: function (options) {
141
- customDefaults = options
142
- },
143
- serve: restify,
144
- }
@@ -1,26 +0,0 @@
1
- 'use strict'
2
-
3
- module.exports = function (options) {
4
- const errorHandler = require('../errorHandler')(options)
5
-
6
- return function (req, res, next) {
7
- const handler = function (err, access) {
8
- if (err) {
9
- return errorHandler(req, res, next)(err)
10
- }
11
-
12
- if (['public', 'private', 'protected'].indexOf(access) < 0) {
13
- throw new Error('Unsupported access, must be "private", "protected" or "public"')
14
- }
15
-
16
- req.access = access
17
- next()
18
- }
19
-
20
- if (options.access.length > 1) {
21
- options.access(req, handler)
22
- } else {
23
- handler(null, options.access(req))
24
- }
25
- }
26
- }
@@ -1,19 +0,0 @@
1
- 'use strict'
2
-
3
- module.exports = function (options) {
4
- const errorHandler = require('../errorHandler')(options)
5
-
6
- return function ensureContentType(req, res, next) {
7
- const ct = req.headers['content-type']
8
-
9
- if (!ct) {
10
- return errorHandler(req, res, next)(new Error('missing_content_type'))
11
- }
12
-
13
- if (ct.indexOf('application/json') === -1) {
14
- return errorHandler(req, res, next)(new Error('invalid_content_type'))
15
- }
16
-
17
- next()
18
- }
19
- }
@@ -1,35 +0,0 @@
1
- 'use strict'
2
-
3
- const http = require('http')
4
-
5
- module.exports = function (model, options) {
6
- const errorHandler = require('../errorHandler')(options)
7
-
8
- return function (req, res, next) {
9
- const contextModel = (req.erm && req.erm.model) || model
10
-
11
- if (!req.params.id) {
12
- return next()
13
- }
14
-
15
- options.contextFilter(contextModel, req, (filteredContext) => {
16
- filteredContext
17
- .findOne()
18
- .and({
19
- [options.idProperty]: req.params.id,
20
- })
21
- .lean(false)
22
- .read(options.readPreference || 'p')
23
- .exec()
24
- .then((doc) => {
25
- if (!doc) {
26
- return errorHandler(req, res, next)(new Error(http.STATUS_CODES[404]))
27
- }
28
-
29
- req.erm.document = doc
30
-
31
- next()
32
- }, errorHandler(req, res, next))
33
- })
34
- }
35
- }
@@ -1,26 +0,0 @@
1
- 'use strict'
2
-
3
- const { serializeError } = require('serialize-error')
4
-
5
- module.exports = function (isExpress) {
6
- return function (err, req, res, next) {
7
- const serializedErr = serializeError(err)
8
-
9
- delete serializedErr.stack
10
-
11
- if (serializedErr.errors) {
12
- for (const key in serializedErr.errors) {
13
- delete serializedErr.errors[key].reason
14
- delete serializedErr.errors[key].stack
15
- }
16
- }
17
-
18
- res.setHeader('Content-Type', 'application/json')
19
-
20
- if (isExpress) {
21
- res.status(req.erm.statusCode).send(serializedErr)
22
- } else {
23
- res.send(req.erm.statusCode, serializedErr)
24
- }
25
- }
26
- }
@@ -1,15 +0,0 @@
1
- 'use strict'
2
-
3
- module.exports = function (isExpress) {
4
- return function output(req, res) {
5
- if (isExpress) {
6
- if (req.erm.result) {
7
- res.status(req.erm.statusCode).json(req.erm.result)
8
- } else {
9
- res.sendStatus(req.erm.statusCode)
10
- }
11
- } else {
12
- res.send(req.erm.statusCode, req.erm.result)
13
- }
14
- }
15
- }