<div dir="ltr"><span style="font-size:12.8px">I'm trying to implement a routing logic with nginScript. I haven't been successful because I miss important javascript feature.</span><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I would like to give you my feedback just in case it may help to improve njs (from more important/blocking to less important):<br><div><br></div><div><ul><li style="margin-left:15px">There is no way to iterate through the keys of an object. It is not supported none of the following methods:</li><ul><li style="margin-left:15px">Object.keys</li><li style="margin-left:15px">Object.getOwnPropertyNames()<br></li><li style="margin-left:15px">for ... in</li></ul><li style="margin-left:15px">I would like to use/import nginx variables. Something like <a href="http://mailman.nginx.org/pipermail/nginx-devel/2016-May/008207.html" target="_blank">http://mailman.nginx.org/pipermail/nginx-devel/2016-May/008207.html</a> would be great.</li><li style="margin-left:15px">I miss string.split function. Probably map, reduce, and many other methods as well.</li><li style="margin-left:15px">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).</li><li style="margin-left:15px">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).<br></li><li style="margin-left:15px">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).</li><li style="margin-left:15px">Logging function would be nice to help debugging.</li></ul></div></div><div style="font-size:12.8px">Hope it can be helpful</div></div>