Welcome! Log In Create A New Profile


[nginx-announce] njs-0.5.2

Posted by Dmitry Volyntsev 
Dmitry Volyntsev
[nginx-announce] njs-0.5.2
March 09, 2021 01:12PM

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;
: }
: 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:
- Writing njs code using TypeScript definition files:

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

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

*) Bugfix: fixed property descriptor reuse for not extensible
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.

nginx-announce mailing list
Sorry, you do not have permission to post/reply in this forum.

Online Users

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