Welcome! Log In Create A New Profile

Advanced

Re: njs-0.8.1

Dmitry Volyntsev
September 12, 2023 08:36PM
On 12.09.2023 16:48, Manuel wrote:
> Hello,
>
> thank you for all the work for njs.
> We will probably use it in one of our next projects.
>
> Regarding the example
>
>> let body = async reply.text();
> should it be const body = await reply.next(); ?
>
> Kind regards,
> Manuel
>
Hi Manuel, you you are right. It is a typo.


>
>
>> Am 13.09.2023 um 01:10 schrieb Dmitry Volyntsev <xeioex@nginx.com>:
>>
>> Hello,
>>
>> I'm glad to announce a new release of NGINX JavaScript module (njs).
>>
>> Notable new features:
>> - Periodic code execution:
>> js_periodic direcrive specifies a content handler to run at regular interval.
>> The handler receives a session object as its first argument, it also has access
>> to global objects such as ngx.
>>
>> : example.conf:
>> : location @periodics {
>> : # to be run at 1 minute intervals in worker process 0
>> : js_periodic main.handler interval=60s;
>> :
>> : # to be run at 1 minute intervals in all worker processes
>> : js_periodic main.handler interval=60s worker_affinity=all;
>> :
>> : # to be run at 1 minute intervals in worker processes 1 and 3
>> : js_periodic main.handler interval=60s worker_affinity=0101;
>> :
>> : resolver 10.0.0.1;
>> : js_fetch_trusted_certificate /path/to/ISRG_Root_X1.pem;
>> : }
>> :
>> : example.js:
>> : async function handler(s) {
>> : let reply = async ngx.fetch('https://nginx.org/en/docs/njs/');
>> : let body = async reply.text();
>> :
>> : ngx.log(ngx.INFO, body);
>> : }
>>
>> Learn more about njs:
>>
>> - Overview and introduction:
>> https://nginx.org/en/docs/njs/
>> - NGINX JavaScript in Your Web Server Configuration:
>> https://youtu.be/Jc_L6UffFOs
>> - Extending NGINX with Custom Code:
>> https://youtu.be/0CVhq4AUU7M
>> - Using node modules with njs:
>> https://nginx.org/en/docs/njs/node_modules.html
>> - Writing njs code using TypeScript definition files:
>> https://nginx.org/en/docs/njs/typescript.html
>>
>> Feel free to try it and give us feedback on:
>>
>> - Github:
>> https://github.com/nginx/njs/issues
>> - Mailing list:
>> https://mailman.nginx.org/mailman/listinfo/nginx-devel
>>
>> Additional examples and howtos can be found here:
>>
>> - Github:
>> https://github.com/nginx/njs-examples
>>
>> Changes with njs 0.8.1 12 Sep 2023
>>
>> nginx modules:
>>
>> *) Feature: introduced js_periodic directive.
>> The directive specifies a JS handler to run at regular intervals.
>>
>> *) Feature: implemented items() method for a shared dictionary.
>> The method returns all the non-expired key-value pairs.
>>
>> *) Bugfix: fixed size() and keys() methods of a shared dictionary.
>>
>> *) Bugfix: fixed erroneous exception in r.internalRedirect()
>> introduced in 0.8.0.
>>
>> Core:
>>
>> *) Bugfix: fixed incorrect order of keys in
>> Object.getOwnPropertyNames().
>> _______________________________________________
>> nginx mailing list
>> nginx@nginx.org
>> https://mailman.nginx.org/mailman/listinfo/nginx
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> https://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
nginx@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

njs-0.8.1

Dmitry Volyntsev September 12, 2023 07:10PM

Re: njs-0.8.1

Manuel September 12, 2023 07:50PM

Re: njs-0.8.1

Dmitry Volyntsev September 12, 2023 08:36PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 273
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready