nginScript + nginx 1.11.4, js_run unknown directive ?
Igor Sysoev
igor at sysoev.ru
Wed Sep 14 06:13:21 UTC 2016
On 14 Sep 2016, at 05:32, George <nginx-forum at 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
More information about the nginx
mailing list