@ladjs/api 14.1.23 → 14.2.0

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/index.js +7 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -44,8 +44,11 @@ class API {
44
44
  // eslint-disable-next-line complexity
45
45
  constructor(config, Users) {
46
46
  this.config = {
47
- removeTrailingSlashes: true,
48
47
  ...sharedConfig('API'),
48
+ removeTrailingSlashes: true,
49
+ prettyPrintedJSON: process.env.PRETTY_PRINTED_JSON
50
+ ? Boolean(process.env.PRETTY_PRINTED_JSON)
51
+ : false,
49
52
  ...config
50
53
  };
51
54
 
@@ -163,8 +166,9 @@ class API {
163
166
  return bodyParser(this.config.bodyParser || {})(ctx, next);
164
167
  });
165
168
 
166
- // Pretty-printed json responses
167
- app.use(json());
169
+ // pretty-printed json responses
170
+ // (default unless in development/test environment)
171
+ app.use(json({ pretty: this.config.prettyPrintedJSON, param: 'pretty' }));
168
172
 
169
173
  // Passport
170
174
  if (this.passport) app.use(this.passport.initialize());
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ladjs/api",
3
3
  "description": "API server for Lad",
4
- "version": "14.1.23",
4
+ "version": "14.2.0",
5
5
  "author": "Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)",
6
6
  "bugs": {
7
7
  "url": "https://github.com/ladjs/api/issues",