[nginx-announce] njs-0.7.10

Dmitry Volyntsev xeioex at nginx.com
Tue Feb 7 23:59:56 UTC 2023


I'm glad to announce a new feature heavy release of NGINX JavaScript
module (njs).

Notable new features:
- Fetch API extended support, including Headers() and Request()
: async function makeRequest(uri, headers) {
:     let h = new Headers(headers);
:     h.delete("bar");
:     h.append("foo", "xxx");
:     let r = new Request(uri, {headers: h});
:     return await ngx.fetch(r);
: }

- Extended WebCrypto API, most notably JWK support was added:
: async function importSigningJWK(jwk) {
:    return await crypto.subtle.importKey('jwk', jwk,
:                                         {name: "RSASSA-PKCS1-v1_5"},
:                                         true, ['sign']);
: }

- XML parsing module:
: const xml = require("xml");
: let data = `<note><to b="bar" a= "foo" 
: let doc = xml.parse(data);
: console.log(doc.note.to.$text) /* 'Tove' */
: console.log(doc.note.to.$attr$b) /* 'bar' */
: console.log(doc.note.$tags[1].$text) /* 'Jani' */

Learn more about njs:

- Overview and introduction:
- NGINX JavaScript in Your Web Server Configuration:
- Extending NGINX with Custom Code:
- Using node modules with njs:
- Writing njs code using TypeScript definition files:

Feel free to try it and give us feedback on:

- Github:
- Mailing list:

Additional examples and howtos can be found here:

- Github:

Changes with njs 0.7.10                                      7 Feb 2023
     nginx modules:

     *) Feature: added Request, Response and Headers ctors in Fetch API.

     *) Bugfix: fixed nginx logger callback for calls in master process.


     *) Feature: added signal support in CLI.

     *) Feature: added "xml" module for working with XML documents.

     *) Feature: extended support for symmetric and asymmetric keys
        in WebCrypto. Most notably JWK format for importKey() was added.
        generateKey() and exportKey() were also implemented.

     *) Feature: added String.prototype.replaceAll().

     *) Bugfix: fixed for(expr1; conditional syntax error handling.

     *) Bugfix: fixed Object.values() and Object.entries() with external

     *) Bugfix: fixed RegExp.prototype[@@replace]().

More information about the nginx-announce mailing list