Welcome! Log In Create A New Profile


[nginx-announce] njs-0.4.0

Posted by Dmitry Volyntsev 
Dmitry Volyntsev
[nginx-announce] njs-0.4.0
April 23, 2020 12:12PM

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

This release focuses on extending http and stream modules.

Notable new features:
- js_import directive.
: nginx.conf:
: js_import foo.js;
: js_import lib from path/file.js;
: location / {
: js_content foo.bar;
: }
: foo.js:
: function bar(r) {
: r.return(200);
: }
: export default {bar};

- multi-value headers support in r.headersOut:
: foo.js:
: function content(r) {
: r.headersOut[‘Set-Cookie’] = [
: ‘foo=111; Max-Age=3600; path=/’,
: ‘bar=qqq; Max-Age=86400; path=/’
: ];
: r.return(200);
: }

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

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.4.0 23 Apr 2020

nginx modules:

*) Feature: added js_import directive.

*) Feature: added support for multi-value headers in r.headersOut.

*) Improvement: iteration over r.headersOut with special headers.

*) Improvement: iteration over r.headersOut with duplicates.

*) Change: r.responseBody property handler now returns “undefined”
instead of throwing an exception if response body is not available.


*) Feature: added script arguments support in CLI.

*) Feature: converting externals values to native js objects.

*) Bugfix: fixed NULL-pointer dereference in “__proto__” property

*) Bugfix: fixed handling of no-newline at the end of the script.

*) Bugfix: fixed RegExp() constructor with empty pattern and
non-empty flags.

*) Bugfix: fixed String.prototype.replace() when function
returns non-string.

*) Bugfix: fixed reading of pseudofiles in “fs”.
nginx-announce mailing list
Sorry, you do not have permission to post/reply in this forum.

Online Users

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