Mercurial > hg > nginx-site
annotate xml/ru/docs/http/ngx_http_js_module.xml @ 2533:617bc29bd759
Removed phrase "This module is not built by default" from js modules.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Wed, 22 Apr 2020 16:54:18 +0100 |
parents | 407c5bd5bffc |
children | 33468af2eaf7 |
rev | line source |
---|---|
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
1 <?xml version="1.0"?> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
2 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
3 <!-- |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
4 Copyright (C) Nginx, Inc. |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
5 --> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
6 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
7 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
8 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
9 <module name="Модуль ngx_http_js_module" |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
10 link="/ru/docs/http/ngx_http_js_module.html" |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
11 lang="ru" |
2533
617bc29bd759
Removed phrase "This module is not built by default" from js modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2530
diff
changeset
|
12 rev="21"> |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
13 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
14 <section id="summary"> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
15 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
16 <para> |
1844
f56626ce9c40
Changed JavaScript to nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1843
diff
changeset
|
17 Модуль <literal>ngx_http_js_module</literal> позволяет задавать |
f56626ce9c40
Changed JavaScript to nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1843
diff
changeset
|
18 обработчики location и переменных |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
19 на <link doc="../njs/index.xml">njs</link> — |
1844
f56626ce9c40
Changed JavaScript to nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1843
diff
changeset
|
20 подмножестве языка JavaScript. |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
21 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
22 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
23 <para> |
2188
523dc4cc8745
Updated installation procedure in njs modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2187
diff
changeset
|
24 Инструкция по сборке и установке доступны |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
25 <link doc="../njs/install.xml">здесь</link>. |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
26 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
27 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
28 </section> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
29 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
30 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
31 <section id="example" name="Пример конфигурации"> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
32 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
33 <para> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
34 Пример работает начиная с версии |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
35 <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link>. |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
36 <example> |
2190
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
37 load_module modules/ngx_http_js_module.so; |
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
38 ... |
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
39 |
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
40 http { |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
41 js_import http.js; |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
42 |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
43 js_set $foo http.foo; |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
44 js_set $summary http.summary; |
1858
36cbfff92c6d
Restricted context of js_set directive to http and stream only.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1853
diff
changeset
|
45 |
2190
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
46 server { |
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
47 listen 8000; |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
48 |
2190
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
49 location / { |
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
50 add_header X-Foo $foo; |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
51 js_content http.baz; |
2190
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
52 } |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
53 |
2206
5cacd6fffade
Eliminated some examples of unsafe prefix locations.
Ruslan Ermilov <ru@nginx.com>
parents:
2190
diff
changeset
|
54 location = /summary { |
2190
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
55 return 200 $summary; |
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
56 } |
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
57 |
2206
5cacd6fffade
Eliminated some examples of unsafe prefix locations.
Ruslan Ermilov <ru@nginx.com>
parents:
2190
diff
changeset
|
58 location = /hello { |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
59 js_content http.hello; |
2190
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
60 } |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
61 } |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
62 } |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
63 </example> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
64 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
65 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
66 <para> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
67 The <path>http.js</path> file: |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
68 <example> |
2187
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
69 function foo(r) { |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
70 r.log("hello from foo() handler"); |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
71 return "foo"; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
72 } |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
73 |
2187
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
74 function summary(r) { |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
75 var a, s, h; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
76 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
77 s = "JS summary\n\n"; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
78 |
2187
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
79 s += "Method: " + r.method + "\n"; |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
80 s += "HTTP version: " + r.httpVersion + "\n"; |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
81 s += "Host: " + r.headersIn.host + "\n"; |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
82 s += "Remote Address: " + r.remoteAddress + "\n"; |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
83 s += "URI: " + r.uri + "\n"; |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
84 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
85 s += "Headers:\n"; |
2187
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
86 for (h in r.headersIn) { |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
87 s += " header '" + h + "' is '" + r.headersIn[h] + "'\n"; |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
88 } |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
89 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
90 s += "Args:\n"; |
2187
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
91 for (a in r.args) { |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
92 s += " arg '" + a + "' is '" + r.args[a] + "'\n"; |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
93 } |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
94 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
95 return s; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
96 } |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
97 |
2187
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
98 function baz(r) { |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
99 r.status = 200; |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
100 r.headersOut.foo = 1234; |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
101 r.headersOut['Content-Type'] = "text/plain; charset=utf-8"; |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
102 r.headersOut['Content-Length'] = 15; |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
103 r.sendHeader(); |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
104 r.send("nginx"); |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
105 r.send("java"); |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
106 r.send("script"); |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
107 |
2187
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
108 r.finish(); |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
109 } |
2190
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
110 |
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
111 function hello(r) { |
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
112 r.return(200, "Hello world!"); |
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
113 } |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
114 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
115 export default {foo, summary, baz, hello}; |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
116 </example> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
117 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
118 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
119 </section> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
120 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
121 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
122 <section id="directives" name="Директивы"> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
123 |
2142
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
124 <directive name="js_content"> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
125 <syntax><value>функция</value> | <value>модуль.функция</value></syntax> |
2142
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
126 <default/> |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
127 <context>location</context> |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
128 <context>limit_except</context> |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
129 |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
130 <para> |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
131 Задаёт функцию njs в качестве обработчика содержимого location. |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
132 Начиная с версии <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
133 можно ссылаться на функцию модуля. |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
134 </para> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
135 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
136 </directive> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
137 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
138 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
139 <directive name="js_import"> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
140 <syntax><value>модуль.js</value> | |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
141 <value>имя_экспорта из модуль.js</value></syntax> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
142 <default/> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
143 <context>http</context> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
144 <appeared-in>0.4.0</appeared-in> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
145 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
146 <para> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
147 Импортирует модуль, позволяющий задавать обработчики location и переменных |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
148 на njs. |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
149 <literal>Имя_экспорта</literal> является пространством имён |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
150 при доступе к функциям модуля. |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
151 Если <literal>имя_экспорта</literal> не задано, |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
152 то пространством имён будет являться имя модуля. |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
153 <example> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
154 js_import http.js; |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
155 </example> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
156 В примере при доступе к экспорту в качестве |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
157 пространства имён используется имя модуля <literal>http</literal>. |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
158 Если импортируемый модуль содержит <literal>foo()</literal>, |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
159 то для доступа используется <literal>http.foo</literal>. |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
160 </para> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
161 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
162 <para> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
163 Директив <literal>js_import</literal> может быть несколько. |
2142
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
164 </para> |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
165 |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
166 </directive> |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
167 |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
168 |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
169 <directive name="js_include"> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
170 <syntax><value>файл</value></syntax> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
171 <default/> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
172 <context>http</context> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
173 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
174 <para> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
175 Задаёт файл, позволяющий задавать обработчики location и переменных на njs: |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
176 <example> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
177 nginx.conf: |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
178 js_include http.js; |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
179 location /version { |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
180 js_content version; |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
181 } |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
182 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
183 http.js: |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
184 function version(r) { |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
185 r.return(200, njs.version); |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
186 } |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
187 </example> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
188 </para> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
189 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
190 <para> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
191 Директива устарела начиная с |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
192 <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link>, |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
193 вместо неё следует использовать директиву <link id="js_import"/>. |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
194 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
195 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
196 </directive> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
197 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
198 |
2352
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
199 <directive name="js_path"> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
200 <syntax> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
201 <value>путь</value></syntax> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
202 <default/> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
203 <context>http</context> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
204 <appeared-in>0.3.0</appeared-in> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
205 |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
206 <para> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
207 Задаёт дополнительный путь для модулей njs. |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
208 </para> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
209 |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
210 </directive> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
211 |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
212 |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
213 <directive name="js_set"> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
214 <syntax> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
215 <value>$переменная</value> <value>функция</value> | |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
216 <value>модуль.функция</value></syntax> |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
217 <default/> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
218 <context>http</context> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
219 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
220 <para> |
2128
59a3cc84f507
Renamed nginScript to njs
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2026
diff
changeset
|
221 Задаёт функцию njs для указанной переменной. |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
222 Начиная с <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
223 можно ссылаться на функцию модуля. |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
224 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
225 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
226 </directive> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
227 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
228 </section> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
229 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
230 |
2187
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
231 <section id="arguments" name="Аргумент запроса"> |
2149
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
232 |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
233 <para> |
2187
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
234 Каждый HTTP-обработчик njs получает один аргумент, |
2288
786e96c52c7a
Corrected links and example in Russian http and stream js modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
235 <link doc="../njs/reference.xml" id="http">объект</link> запроса. |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
236 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
237 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
238 </section> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
239 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
240 </module> |