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

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()
constructors:
: 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"
>Tove</to><from>Jani</from></note>`;
: 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:
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.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.

Core:

*) 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
objects.

*) Bugfix: fixed RegExp.prototype[@@replace]().
_______________________________________________
nginx-announce mailing list
nginx-announce@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-announce
Sorry, you do not have permission to post/reply in this forum.

Online Users

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