On Wednesday, 31 October 2018 01:47:49 MSK alweiss wrote:
> My problem is that services can be one, two … ten etc … so not easy to place
> in the callback of the previous subrequest ...
>
Actually it's not a problem. Here's an example:
function authorize(r) {
var n = 0;
var svcs = ['one
Ok, got it !
Thanks much Valentin, Maxim and Dmitry for your guidance.
I decided to go as the nginx sample
(https://www.nginx.com/blog/batching-api-requests-nginx-plus-javascript-module/)
with the resp var which is concatened with result of each subrequest : my
final_status starts with 403 at init
My problem is that services can be one, two … ten etc … so not easy to place
in the callback of the previous subrequest ...
Posted at Nginx Forum:
https://forum.nginx.org/read.php?2,281699,281753#msg-281753
___
nginx mailing list
nginx@nginx.org
http:/
On 31/10/2018 01:27, Valentin V. Bartenev wrote:
> On Wednesday, 31 October 2018 00:55:20 MSK you wrote:
> [..]
>
>> However, when i run it, the result is as below :
>> The suprising thing is the order it is logged : it seems : as we go for
>> async, perhaps both request are started at the same ti
On Wednesday, 31 October 2018 00:55:20 MSK you wrote:
[..]
> However, when i run it, the result is as below :
> The suprising thing is the order it is logged : it seems : as we go for
> async, perhaps both request are started at the same time so each one get a
> starting of 403 (no yet updated). C
Thanks guys, this is a first step.
I moved declaration to the top of my script :
START SCRIPT *
var n = 0;
var final_status = 403;
var servicesCodes = ['rest','oass'];
var requestCount = servicesCodes.length;
function authorize(req, res) {
req.warn('Variables init ...');
On Tuesday 30 October 2018 12:58:53 alweiss wrote:
> Here is a sample that works with Java but not with njs :
>
> function my() {
> resp = "Start";
> console.log ('Initial resp is ' + resp);
>
> function done() {
> resp += "AndContinue";
> console.log('In loop resp is
On 30.10.2018 19:58, alweiss wrote:
Here is a sample that works with Java but not with njs :
function my() {
resp = "Start";
console.log ('Initial resp is ' + resp);
function done() {
resp += "AndContinue";
console.log('In loop resp is ' + resp)
}
Here is a sample that works with Java but not with njs :
function my() {
resp = "Start";
console.log ('Initial resp is ' + resp);
function done() {
resp += "AndContinue";
console.log('In loop resp is ' + resp)
}
done();
}
resp = 'empty'
my();
console.log('End
Hi Dmitry, thanks for your reply.
Here is my code called using js_content authorize; from a location {}
I want to say "if at least one subrequest answers HTTP/200, set the
final_status to 200 and at then end, return 200"
First thing is that i must declare requestCount with var. If i don't, i get
Hi Alex,
Can you, please, share your code?
You can also try to play with njs code in the command line interface.
For example:
njs
interactive njs 0.2.3
v. -> the properties and prototype methods of v.
type console.help() for more information
>>function my(){var g = 'init'; console.log(g); (
Hi team !,
Regarding the sample here :
https://www.nginx.com/blog/batching-api-requests-nginx-plus-javascript-module/
I have an issue trying to use JS module : variable hoisting and global/local
scope doesn't behave as expected. When i try to reassign the resp variable
(as you do after declaring i
12 matches
Mail list logo