@azteam/express 1.2.468 → 1.2.470
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/lib/Server.js +4 -2
- package/package.json +1 -1
- package/src/Server.js +5 -5
package/lib/Server.js
CHANGED
|
@@ -123,6 +123,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
123
123
|
app.use((0, _helmet["default"])({
|
|
124
124
|
frameguard: false
|
|
125
125
|
}));
|
|
126
|
+
app.set('view engine', 'ejs');
|
|
126
127
|
app.use((0, _methodOverride["default"])());
|
|
127
128
|
app.use(_bodyParser["default"].urlencoded({
|
|
128
129
|
limit: '5mb',
|
|
@@ -342,12 +343,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
342
343
|
var error = (0, _error.errorCatch)(err);
|
|
343
344
|
if (process.env.NODE_ENV === 'development') {
|
|
344
345
|
console.log(error.errors);
|
|
345
|
-
} else if (error.errors[0].code === _error.UNKNOWN) {
|
|
346
|
-
console.error(req.originalUrl, err);
|
|
347
346
|
}
|
|
348
347
|
if (_this4.callbackError) {
|
|
349
348
|
_this4.callbackError(error, req.originalUrl);
|
|
350
349
|
}
|
|
350
|
+
if (error.errors[0].code === _error.UNKNOWN) {
|
|
351
|
+
error.errors[0].message = '';
|
|
352
|
+
}
|
|
351
353
|
return res.status(error.status).json({
|
|
352
354
|
success: false,
|
|
353
355
|
errors: error.errors
|
package/package.json
CHANGED
package/src/Server.js
CHANGED
|
@@ -99,6 +99,8 @@ class Server {
|
|
|
99
99
|
})
|
|
100
100
|
);
|
|
101
101
|
|
|
102
|
+
app.set('view engine', 'ejs');
|
|
103
|
+
|
|
102
104
|
app.use(methodOverride());
|
|
103
105
|
app.use(bodyParser.urlencoded({limit: '5mb', extended: true}));
|
|
104
106
|
app.use(bodyParser.json({limit: '5mb'}));
|
|
@@ -313,17 +315,15 @@ class Server {
|
|
|
313
315
|
|
|
314
316
|
app.use((err, req, res, next) => {
|
|
315
317
|
const error = errorCatch(err);
|
|
316
|
-
|
|
317
318
|
if (process.env.NODE_ENV === 'development') {
|
|
318
319
|
console.log(error.errors);
|
|
319
|
-
} else if (error.errors[0].code === UNKNOWN) {
|
|
320
|
-
console.error(req.originalUrl, err);
|
|
321
320
|
}
|
|
322
|
-
|
|
323
321
|
if (this.callbackError) {
|
|
324
322
|
this.callbackError(error, req.originalUrl);
|
|
325
323
|
}
|
|
326
|
-
|
|
324
|
+
if (error.errors[0].code === UNKNOWN) {
|
|
325
|
+
error.errors[0].message = '';
|
|
326
|
+
}
|
|
327
327
|
return res.status(error.status).json({success: false, errors: error.errors});
|
|
328
328
|
});
|
|
329
329
|
|