Comparing version 0.11.12 to 0.11.13
@@ -205,2 +205,3 @@ const assert = require('assert'); | ||
input.fork = fork.bind(app, input); | ||
input.call = (fn, ...args) => fn.call(app, input, ...args); | ||
@@ -207,0 +208,0 @@ const req = input.req = input.req || generateRequestObject(method, path, input); |
@@ -70,2 +70,4 @@ const | ||
this.call = (fn, ...args) => fn.call(this, { ...this.global, ...this }, ...args); | ||
this.conf = {}; | ||
@@ -163,6 +165,2 @@ this.state = 'standby'; | ||
call(fn, ...args){ | ||
return fn.call(this, { ...this.global, conf: this.conf, log: this.log }, ...args); | ||
} | ||
trigger(method, path, input){ | ||
@@ -169,0 +167,0 @@ return this._api.trigger(method, path, input); |
{ | ||
"name": "nodecaf", | ||
"version": "0.11.12", | ||
"version": "0.11.13", | ||
"description": "Nodecaf is a light framework for developing RESTful Apps in a quick and convenient manner.", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
@@ -39,3 +39,3 @@ # [Nodecaf](https://gitlab.com/GCSBOSS/nodecaf) | ||
// Perform your server initialization logic. | ||
async startup({ conf, log, global }){ | ||
async startup({ conf, log, call }){ | ||
@@ -45,3 +45,3 @@ }, | ||
// Perform your server finalization logic. | ||
async shutdown({ conf, log, global }){ | ||
async shutdown({ conf, log, call }){ | ||
@@ -164,3 +164,3 @@ } | ||
```js | ||
function({ req, res, next, query, params, body, flash, conf, log, headers }){ | ||
function({ req, res, next, query, params, body, flash, conf, log, headers, call }){ | ||
// Do your stuff. | ||
@@ -183,2 +183,4 @@ } | ||
your application. | ||
- `call`: Calls any user function passing the handler args as the first argument. | ||
Signature: `call(userFunc, ...extraArgs)`. | ||
- Also all keys of the [globally exposed object](#expose-globals) are available | ||
@@ -395,3 +397,3 @@ as handler args for all routes. | ||
global.libX = new LibXInstance(); | ||
} | ||
} | ||
}); | ||
@@ -398,0 +400,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41130
511
624