Welcome! Log In Create A New Profile

Advanced

[nginx-announce] njs-0.4.1

Posted by Dmitry Volyntsev 
Dmitry Volyntsev
[nginx-announce] njs-0.4.1
May 19, 2020 10:26AM
Hello,

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

This release extends http module.

Notable new features:
- raw headers API:
With the following request headers:
: Host: localhost
: Foo: bar
: foo: bar2
All 'foo' headers can be collected with the syntax:
: r.rawHeadersIn.filter(v=>v[0].toLowerCase() == 'foo').map(v=>v[1]);
the output will be:
: ['bar', 'bar2']

- TypeScript API definition:
: foo.ts:
: /// <reference path="ngx_http_js_module.d.ts" />
: function content_handler(r: NginxHTTPRequest)
: {
: r.headersOut['content-type'] = 'text/plain';
: r.return(200, "Hello from TypeScript");
: }
:
: tsc foo.ts --outFile foo.js
foo.js can be used directly with njs.

You can learn more about njs:

- Overview and introduction: http://nginx.org/en/docs/njs/
- 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.4.1 19 May 2020

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

*) Feature: introduced raw headers API.

*) Feature: added TypeScript API description.

Core:

*) Bugfix: fixed Array.prototype.slice() for sparse arrays._______________________________________________
nginx-announce mailing list
nginx-announce@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-announce
Sorry, you do not have permission to post/reply in this forum.

Online Users

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