Welcome! Log In Create A New Profile

Advanced

[nginx-announce] njs-0.7.0

Posted by Dmitry Volyntsev 
Dmitry Volyntsev
[nginx-announce] njs-0.7.0
October 19, 2021 12:46PM
Hello,

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

This release adds a bunch of long-awaited features.

Notable new features:
- async/await support:
- HTTPS support in Fetch API:
: async function content(r) {
: let results = await Promise.all([ngx.fetch('https://nginx.org/'),
: ngx.fetch('https://nginx.org/en/')]);
:
: r.return(200, JSON.stringify(results, undefined, 4));
: }

- WebCrypto API support:
: async function host_hash(r) {
: let hash = await crypto.subtle.digest('SHA-512', r.headersIn.host);
: r.setReturnValue(Buffer.from(hash).toString('hex'));
: }

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

We are hiring:

If you are a C programmer, passionate about Open Source and you
love what we do, consider the following career opportunity:
https://ffive.wd5.myworkdayjobs.com/NGINX/job/Ireland-Homebase/Software-Engineer-III---NGNIX-NJS_RP1022237

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


Changes with njs 0.7.0 19 Oct 2021

nginx modules:

*) Feature: added HTTPS support for Fetch API.

*) Feature: added setReturnValue() method.

Core:

*) Feature: introduced Async/Await implementation.

*) Feature: added WebCrypto API implementation.

*) Bugfix: fixed copying of closures for declared
functions. The bug was introduced in 0.6.0.

*) Bugfix: fixed unhandled promise rejection in handle
events.

*) Bugfix: fixed Response.headers getter in Fetch API.

_______________________________________________
nginx-announce mailing list
nginx-announce@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-announce
Sorry, you do not have permission to post/reply in this forum.

Online Users

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