changeset 2190:dfc49994218c

Updated example in HTTP njs module.
author Yaroslav Zhuravlev <yar@nginx.com>
date Tue, 19 Jun 2018 20:43:33 +0300
parents 23cfb62121d1
children 2c56f91c304a
files xml/en/docs/http/ngx_http_js_module.xml xml/en/docs/stream/ngx_stream_js_module.xml xml/ru/docs/http/ngx_http_js_module.xml xml/ru/docs/stream/ngx_stream_js_module.xml
diffstat 4 files changed, 56 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/xml/en/docs/http/ngx_http_js_module.xml
+++ b/xml/en/docs/http/ngx_http_js_module.xml
@@ -9,7 +9,7 @@
 <module name="Module ngx_http_js_module"
         link="/en/docs/http/ngx_http_js_module.html"
         lang="en"
-        rev="13">
+        rev="14">
 
 <section id="summary">
 
@@ -33,21 +33,30 @@ Download and install instructions are av
 
 <para>
 <example>
-js_include http.js;
+load_module modules/ngx_http_js_module.so;
+...
+
+http {
+    js_include http.js;
 
-js_set $foo     foo;
-js_set $summary summary;
+    js_set $foo     foo;
+    js_set $summary summary;
 
-server {
-    listen 8000;
+    server {
+        listen 8000;
 
-    location / {
-        add_header X-Foo $foo;
-        js_content baz;
-    }
+        location / {
+            add_header X-Foo $foo;
+            js_content baz;
+        }
 
-    location /summary {
-        return 200 $summary;
+        location /summary {
+            return 200 $summary;
+        }
+
+        location /hello {
+            js_content hello;
+        }
     }
 }
 </example>
@@ -97,6 +106,10 @@ function baz(r) {
 
     r.finish();
 }
+
+function hello(r) {
+    r.return(200, "Hello world!");
+}
 </example>
 </para>
 
--- a/xml/en/docs/stream/ngx_stream_js_module.xml
+++ b/xml/en/docs/stream/ngx_stream_js_module.xml
@@ -32,6 +32,9 @@ Download and install instructions are av
 
 <para>
 <example>
+load_module modules/ngx_stream_js_module.so;
+...
+
 stream {
     js_include stream.js;
 
--- a/xml/ru/docs/http/ngx_http_js_module.xml
+++ b/xml/ru/docs/http/ngx_http_js_module.xml
@@ -9,7 +9,7 @@
 <module name="Модуль ngx_http_js_module"
         link="/ru/docs/http/ngx_http_js_module.html"
         lang="ru"
-        rev="13">
+        rev="14">
 
 <section id="summary">
 
@@ -33,21 +33,30 @@
 
 <para>
 <example>
-js_include http.js;
+load_module modules/ngx_http_js_module.so;
+...
+
+http {
+    js_include http.js;
 
-js_set $foo     foo;
-js_set $summary summary;
+    js_set $foo     foo;
+    js_set $summary summary;
 
-server {
-    listen 8000;
+    server {
+        listen 8000;
 
-    location / {
-        add_header X-Foo $foo;
-        js_content baz;
-    }
+        location / {
+            add_header X-Foo $foo;
+            js_content baz;
+        }
 
-    location /summary {
-        return 200 $summary;
+        location /summary {
+            return 200 $summary;
+        }
+
+        location /hello {
+            js_content hello;
+        }
     }
 }
 </example>
@@ -97,6 +106,10 @@ function baz(r) {
 
     r.finish();
 }
+
+function hello(r) {
+    r.return(200, "Hello world!");
+}
 </example>
 </para>
 
--- a/xml/ru/docs/stream/ngx_stream_js_module.xml
+++ b/xml/ru/docs/stream/ngx_stream_js_module.xml
@@ -32,6 +32,9 @@
 
 <para>
 <example>
+load_module modules/ngx_stream_js_module.so;
+...
+
 stream {
     js_include stream.js;