@azteam/express 1.2.128 → 1.2.129

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/ApiServer.js +7 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azteam/express",
3
- "version": "1.2.128",
3
+ "version": "1.2.129",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "repository": {
package/src/ApiServer.js CHANGED
@@ -10,7 +10,7 @@ import morgan from 'morgan';
10
10
  import cors from 'cors';
11
11
  import _ from 'lodash';
12
12
  import 'express-async-errors';
13
- import {errorCatch, ErrorException, NOT_FOUND, UNKNOWN} from '@azteam/error';
13
+ import { errorCatch, ErrorException, NOT_FOUND, UNKNOWN } from '@azteam/error';
14
14
 
15
15
 
16
16
  const RES_TYPE = {
@@ -130,8 +130,8 @@ class ApiServer {
130
130
  }));
131
131
 
132
132
  app.use(methodOverride());
133
- app.use(bodyParser.urlencoded({limit: '5mb', extended: true}));
134
- app.use(bodyParser.json({limit: '5mb'}));
133
+ app.use(bodyParser.urlencoded({ limit: '5mb', extended: true }));
134
+ app.use(bodyParser.json({ limit: '5mb' }));
135
135
 
136
136
  app.set('trust proxy', 1);
137
137
 
@@ -175,6 +175,7 @@ class ApiServer {
175
175
  };
176
176
 
177
177
  res.success = function(data = {}, guard = [], allows = []) {
178
+ let guardData = data;
178
179
  if (data) {
179
180
  let resType = RES_TYPE.ARRAY;
180
181
  if (_.isObject(data)) {
@@ -204,8 +205,6 @@ class ApiServer {
204
205
  ];
205
206
  }
206
207
  }
207
-
208
- let guardData = data;
209
208
  if (resType === RES_TYPE.DOCS) {
210
209
  guardData.docs = _.map(data.docs, item => {
211
210
  return omitItem(item, guard, allows);
@@ -262,7 +261,7 @@ class ApiServer {
262
261
  const listPublicRouter = controller.publicRouter();
263
262
 
264
263
  _.map(listPublicRouter, (method) => {
265
- const {name, type} = method;
264
+ const { name, type } = method;
266
265
 
267
266
  const router = controller[name]();
268
267
 
@@ -303,7 +302,7 @@ class ApiServer {
303
302
  this.callbackError(error);
304
303
  }
305
304
 
306
- return res.status(error.status).json({success: false, errors: error.errors});
305
+ return res.status(error.status).json({ success: false, errors: error.errors });
307
306
  });
308
307
 
309
308
  const server = http.Server(app);
@@ -359,4 +358,4 @@ class ApiServer {
359
358
  }
360
359
  }
361
360
 
362
- export default ApiServer;
361
+ export default ApiServer;