[nginx-announce] njs-0.5.2

Dmitry Volyntsev xeioex at nginx.com
Tue Mar 9 18:11:06 UTC 2021


Hello,

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

This release focuses on extending the modules functionality.

Notable new features:
- js_body_filter directive. The directive allows changing the
     response body.
: nginx.conf:
:   js_import foo.js;
:
:   location / {
:       js_body_filter foo.to_lower;
:       proxy_pass http://127.0.0.1:8081/;
:   }
:
: foo.js:
:   function to_lower(r, data, flags) {
:     r.sendBuffer(data.toLowerCase(), flags);
:   }
:
:   export default {to_lower};
- njs.on('exit') callback. The "exit" hook allows to implement
some cleanup logic before the VM instance is destroyed.
: foo.js:
:   function handler(r) {
:     njs.on('exit', () => {
:         r.warn("DONE");
:     });
:   }

You can learn more about njs:

- Overview and introduction: http://nginx.org/en/docs/njs/
- Presentation: https://youtu.be/Jc_L6UffFOs
- Using node modules with njs:
http://nginx.org/en/docs/njs/node_modules.html
- Writing njs code using TypeScript definition files:
    http://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: http://mailman.nginx.org/mailman/listinfo/nginx-devel


Changes with njs 0.5.2                                        09 Mar 2021

     nginx modules:

     *) Feature: added the "js_body_filter" directive.

     *) Feature: introduced the "status" property for stream session
        object.

     *) Feature: added njs.on('exit') callback support.

     *) Bugfix: fixed property descriptor reuse for not extensible
        objects.
        Thanks to Artem S. Povalyukhin.

     *) Bugfix: fixed Object.freeze() and friends according to
        the specification.
        Thanks to Artem S. Povalyukhin.

     *) Bugfix: fixed Function() in CLI mode.

     *) Bugfix: fixed for-in iteration of typed array values.
        Thanks to Artem S. Povalyukhin.



More information about the nginx-announce mailing list