Want to subscribe to topics you're interested in?
Become a Member

Nginx [nginx-announce] njs-0.4.0

Discussion in 'Nginx and PHP-FPM news & discussions' started by eva2000, Apr 24, 2020.

  1. eva2000

    eva2000 Administrator Staff Member

    49,221
    11,291
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,566
    Local Time:
    5:14 AM
    Nginx 1.21.x
    MariaDB 10.x
    Hello,

    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.

    Core:

    *) Feature: added script arguments support in CLI.

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

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

    *) 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
    nginx-announce@nginx.org
    http://mailman.nginx.org/mailman/listinfo/nginx-announce

    Continue reading...