jaypie 1.0.45 → 1.0.47

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/README.md +16 -1
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -215,6 +215,7 @@ See `HTTP` for status codes.
215
215
  #### `EXPRESS`
216
216
 
217
217
  * `EXPRESS.PATH.ANY` - String `*` for any path
218
+ * `EXPRESS.PATH.ID` - String `/:id` for an ID path
218
219
  * `EXPRESS.PATH.ROOT` - Regular expression for root path
219
220
 
220
221
  #### `HTTP`
@@ -400,6 +401,20 @@ const handler = expressHandler(async(req, res) => {
400
401
  }, { name: "lambdaReference"});
401
402
  ```
402
403
 
404
+ The order of options and handler may be swapped to improve readability. Having lifecycle methods listed before the handler may read more intuitively.
405
+
406
+ ```javascript
407
+ const handler = expressHandler({
408
+ name: "expressOptions",
409
+ setup: [connect],
410
+ teardown: [disconnect],
411
+ }, async(req, res) => {
412
+ // await new Promise(r => setTimeout(r, 2000));
413
+ // log.debug("Hello World");
414
+ return { message: "Hello World" };
415
+ });
416
+ ```
417
+
403
418
  #### Return Types
404
419
 
405
420
  Do not use `res.send` or `res.json` in the handler. The return value of the handler is the response body. The status code is determined by the error thrown or the return value. Custom status codes can be set by calling `res.status` in the handler.
@@ -424,7 +439,7 @@ const handler = expressHandler(async(req) => {
424
439
  // req.locals.key = "static"
425
440
  return { message: "Hello World" };
426
441
  }, {
427
- name: "lambdaReference",
442
+ name: "expressReference",
428
443
  locals: {
429
444
  asyncFn: async() => "async",
430
445
  fn: () => "function",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jaypie",
3
- "version": "1.0.45",
3
+ "version": "1.0.47",
4
4
  "author": "Finlayson Studio",
5
5
  "type": "module",
6
6
  "exports": {
@@ -30,7 +30,7 @@
30
30
  "@jaypie/aws": "^1.0.8",
31
31
  "@jaypie/core": "^1.0.42",
32
32
  "@jaypie/datadog": "^1.0.3",
33
- "@jaypie/express": "^1.0.13",
33
+ "@jaypie/express": "^1.0.14",
34
34
  "@jaypie/lambda": "^1.0.13",
35
35
  "@jaypie/mongoose": "^1.0.9"
36
36
  },