[nginx-announce] njs-0.7.0

Dmitry Volyntsev xeioex at nginx.com
Tue Oct 19 16:44:27 UTC 2021


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.



More information about the nginx-announce mailing list