@steedos/service-api 2.5.3-beta.9 → 2.5.4

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 +83 -0
  2. package/package.json +6 -6
package/index.js CHANGED
@@ -207,6 +207,89 @@ module.exports = {
207
207
  res.writeHead(err.code || 500);
208
208
  res.end(JSON.stringify({ error: err.message, detail: err }));
209
209
  }
210
+ },
211
+ {
212
+ path: "/api/v1",
213
+
214
+ whitelist: [
215
+ "rest.*",
216
+ ],
217
+
218
+ // Route-level Express middlewares. More info: https://moleculer.services/docs/0.14/moleculer-web.html#Middlewares
219
+ use: [],
220
+
221
+ // Enable/disable parameter merging method. More info: https://moleculer.services/docs/0.14/moleculer-web.html#Disable-merging
222
+ mergeParams: true,
223
+
224
+ // Enable authentication. Implement the logic into `authenticate` method. More info: https://moleculer.services/docs/0.14/moleculer-web.html#Authentication
225
+ authentication: true,
226
+
227
+ // Enable authorization. Implement the logic into `authorize` method. More info: https://moleculer.services/docs/0.14/moleculer-web.html#Authorization
228
+ authorization: true,
229
+
230
+ // The auto-alias feature allows you to declare your route alias directly in your services.
231
+ // The gateway will dynamically build the full routes from service schema.
232
+ autoAliases: true,
233
+
234
+ aliases: {
235
+
236
+ },
237
+
238
+ /**
239
+ * Before call hook. You can check the request.
240
+ * @param {Context} ctx
241
+ * @param {Object} route
242
+ * @param {IncomingRequest} req
243
+ * @param {ServerResponse} res
244
+ * @param {Object} data
245
+ *
246
+ onBeforeCall(ctx, route, req, res) {
247
+ // Set request headers to context meta
248
+ ctx.meta.userAgent = req.headers["user-agent"];
249
+ }, */
250
+
251
+ /**
252
+ * After call hook. You can modify the data.
253
+ * @param {Context} ctx
254
+ * @param {Object} route
255
+ * @param {IncomingRequest} req
256
+ * @param {ServerResponse} res
257
+ * @param {Object} data
258
+ onAfterCall(ctx, route, req, res, data) {
259
+ // Async function which return with Promise
260
+ return doSomething(ctx, res, data);
261
+ }, */
262
+
263
+ // Calling options. More info: https://moleculer.services/docs/0.14/moleculer-web.html#Calling-options
264
+ callingOptions: {},
265
+
266
+ bodyParsers: {
267
+ json: {
268
+ strict: false,
269
+ limit: "10MB"
270
+ },
271
+ urlencoded: {
272
+ extended: true,
273
+ limit: "10MB"
274
+ }
275
+ },
276
+
277
+ // Mapping policy setting. More info: https://moleculer.services/docs/0.14/moleculer-web.html#Mapping-policy
278
+ mappingPolicy: "all", // Available values: "all", "restrict"
279
+
280
+ // Enable/disable logging
281
+ logging: false,
282
+
283
+ // Route error handler
284
+ onError(req, res, err) {
285
+ res.setHeader("Content-Type", "application/json; charset=utf-8");
286
+ res.writeHead(err.code || 500);
287
+ res.end(JSON.stringify({
288
+ "status": -1,
289
+ "msg": err.message,
290
+ "data": {}
291
+ }));
292
+ }
210
293
  }
211
294
  ],
212
295
 
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@steedos/service-api",
3
- "version": "2.5.3-beta.9",
3
+ "version": "2.5.4",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
7
- "@steedos/auth": "2.5.3-beta.9",
8
- "@steedos/router": "2.5.3-beta.9",
9
- "@steedos/service-object-graphql": "2.5.3-beta.9",
10
- "@steedos/service-ui": "2.5.3-beta.9",
7
+ "@steedos/auth": "2.5.4",
8
+ "@steedos/router": "2.5.4",
9
+ "@steedos/service-object-graphql": "2.5.4",
10
+ "@steedos/service-ui": "2.5.4",
11
11
  "graphql": "^15.8.0",
12
12
  "graphql-iso-date": "^3.6.1",
13
13
  "graphql-type-json": "^0.3.2",
@@ -19,5 +19,5 @@
19
19
  "publishConfig": {
20
20
  "access": "public"
21
21
  },
22
- "gitHead": "94bb5ef26fa3d0504e3131d2f9d990d4545430a3"
22
+ "gitHead": "0b1b93c80e8448e54b77064d976b9e20bfe39727"
23
23
  }