njs-0.3.8
Dmitry Volyntsev
xeioex at nginx.com
Tue Jan 21 16:49:10 UTC 2020
Hello,
I'm glad to announce a new release of NGINX JavaScript module (njs).
This release proceeds to extend the coverage of ECMAScript
specifications. This release adds Promise object support and
typed-arrays from ES6.
Notable new features:
- Promise support in r.subrequest():
: r.subrequest(r, '/auth')
: .then(reply => JSON.parse(reply.responseBody))
: .then(response => {
: if (!response['token']) {
: throw new Error("token is not available");
: }
: return token;
: })
: .then(token => {
: r.subrequest('/backend', `token=${token}`)
: .then(reply => r.return(reply.status, reply.responseBody));
: })
: .catch(_ => r.return(500));
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.3.8 21 Jan 2020
nginx modules:
*) Feature: added Promise support for r.subrequest(). If callback
is not provided r.subrequest() returns an ordinary Promise object
that resolves to subrequest response object.
*) Change: r.parent property handler now returns "undefined"
instead of throwing exception if parent object is not available.
Core:
*) Feature: added Promise support. Implemented according to
the specification without: Promise.all(), Promise.allSettled(),
Promise.race().
*) Feature: added initial Typed-arrays support.
Thanks to Tiago Natel de Moura.
*) Feature: added ArrayBuffer support.
Thanks to Tiago Natel de Moura.
*) Feature: added initial Symbol support.
Thanks to Artem S. Povalyukhin.
*) Feature: added externals supopor for JSON.stringify().
*) Feature: added Object.is().
Thanks to Artem S. Povalyukhin.
*) Feature: added Object.setPrototypeOf().
Thanks to Artem S. Povalyukhin.
*) Feature: introduced nullish coalescing operator.
Thanks to Valentin Bartenev.
*) Bugfix: fixed Object.getPrototypeOf() according to the
specification.
*) Bugfix: fixed Object.prototype.valueOf() according to the
specification.
*) Bugfix: fixed JSON.stringify() with unprintable values and
replacer function.
*) Bugfix: fixed operator "in" according to the specification.
*) Bugfix: fixed Object.defineProperties() according to the
specification.
*) Bugfix: fixed Object.create() according to the specification.
Thanks to Artem S. Povalyukhin.
*) Bugfix: fixed Number.prototype.toString(radix) when
fast-math is enabled.
*) Bugfix: fixed RegExp() instance properties.
*) Bugfix: fixed import segfault.
Thanks to 洪志道 (Hong Zhi Dao).
More information about the nginx
mailing list