On 14 Sep 2016, at 05:32, George <nginx-forum@forum.nginx.org> wrote:
> even
>
>
> location /njs {
> js_run "
> var res;
> res = $r.response;
> res.status = 200;
> res.send('Hello World!');
> res.finish();
> ";
> }
>
> gives an error
>
> nginx -t
> nginx: [emerg] unknown directive "js_run" in
> /usr/local/nginx/conf/conf.d/virtual.conf:36
> nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
Interface has been changed.
Now you should define a function in a file:
function hw(req, res) {
var res;
...
}
Then include the file with
js_include file.js;
Then use the function to generate content:
location /njs {
js_content hw;
}
--
Igor Sysoev
http://nginx.com
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx