diff xml/en/docs/http/ngx_http_js_module.xml @ 2190:dfc49994218c

Updated example in HTTP njs module.
author Yaroslav Zhuravlev <yar@nginx.com>
date Tue, 19 Jun 2018 20:43:33 +0300
parents 523dc4cc8745
children 5cacd6fffade
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>