Welcome! Log In Create A New Profile

Advanced

nginScript (njs) feedback

Jorge L.
June 22, 2016 02:36PM
I'm trying to implement a routing logic with nginScript. I haven't been
successful because I miss important javascript feature.

I would like to give you my feedback just in case it may help to improve
njs (from more important/blocking to less important):


- There is no way to iterate through the keys of an object. It is not
supported none of the following methods:
- Object.keys
- Object.getOwnPropertyNames()
- for ... in
- I would like to use/import nginx variables. Something like
http://mailman.nginx.org/pipermail/nginx-devel/2016-May/008207.html would
be great.
- I miss string.split function. Probably map, reduce, and many other
methods as well.
- It would be nice to have some "singleton" support where I could set a
variable that is evaluated only once (first time is required or when nginx
is started/reloaded). It's clear that it should not be related to
request/response but this approach would improve performance by avoiding
executing same thing for each request. It would be similar to importing a
javascript module (it's only imported once and global vars and requirements
are satisfied only once).
- I would like to include javascript modules. I'm using a directive:
"include /etc/nginx/js/*.js;" but this .js files need to include the js_set
$xxx "..." which makes the file to be invalid javascript (and you may miss
some features from your javascript IDE).
- It would be nice to access a cookie by name (it wouldn't be necessary
if I could access to a nginx var like $v.cookie_XXX).
- Logging function would be nice to help debugging.

Hope it can be helpful
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginScript (njs) feedback

Jorge L. June 22, 2016 02:36PM

Re: nginScript (njs) feedback

Jorge L. June 23, 2016 07:00AM

Re: nginScript (njs) feedback

Igor Sysoev June 24, 2016 04:30AM

Re: nginScript (njs) feedback

Jorge L. June 24, 2016 12:48PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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