njs-0.8.1

Manuel manuel.baesler at gmail.com
Tue Sep 12 23:48:38 UTC 2023


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


> Am 13.09.2023 um 01:10 schrieb Dmitry Volyntsev <xeioex at 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 at nginx.org
> https://mailman.nginx.org/mailman/listinfo/nginx


More information about the nginx mailing list