Dmitry Volyntsev
[nginx-announce] njs-0.7.10
February 07, 2023 07:00PM

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($text) /* 'Tove' */
: console.log($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]().
nginx-announce mailing list
Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 205
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