Mercurial > hg > nginx-site
annotate xml/ru/docs/njs/examples.xml @ 2624:bd676d1da957
Clarified behavior of multiple proxy_cookie_ directives.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Wed, 25 Nov 2020 12:39:12 +0000 |
parents | c81b1fadbcf3 |
children | 7ad967af16b8 |
rev | line source |
---|---|
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
1 <?xml version="1.0"?> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
2 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
3 <!-- |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
4 Copyright (C) Nginx, Inc. |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
5 --> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
6 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd"> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
8 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
9 <article name="Примеры использования" |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
10 link="/ru/docs/njs/examples.html" |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
11 lang="ru" |
2556
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2536
diff
changeset
|
12 rev="15"> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
13 |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
14 <section id="summary"> |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
15 |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
16 <para> |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
17 Примеры работают начиная с версии |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
18 <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link>. |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
19 </para> |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
20 |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
21 </section> |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
22 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
23 <section id="helloword" name="Hello World"> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
24 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
25 <para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
26 <path>nginx.conf</path>: |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
27 <example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
28 events {} |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
29 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
30 http { |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
31 js_import http.js; |
2556
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2536
diff
changeset
|
32 |
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2536
diff
changeset
|
33 server { |
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2536
diff
changeset
|
34 listen 8000; |
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2536
diff
changeset
|
35 |
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2536
diff
changeset
|
36 location / { |
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2536
diff
changeset
|
37 js_content http.hello; |
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2536
diff
changeset
|
38 } |
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2536
diff
changeset
|
39 } |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
40 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
41 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
42 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
43 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
44 <para> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
45 <literal>http.js</literal>: |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
46 <example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
47 function hello(r) { |
2257
8cef5ef98336
Changed quotes to ASCII in NJS example.
Nick Shadrin <nick@nginx.com>
parents:
2246
diff
changeset
|
48 r.return(200, "Hello world!"); |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
49 } |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
50 |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
51 export default {hello}; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
52 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
53 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
54 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
55 </section> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
56 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
57 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
58 <section id="urldecode" name="Декодирование URL"> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
59 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
60 <para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
61 <path>nginx.conf</path>: |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
62 <example> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
63 js_import http.js; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
64 |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
65 js_set $decoded_foo http.decoded_foo; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
66 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
67 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
68 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
69 <para> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
70 <path>http.js</path>: |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
71 <example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
72 function decoded_foo(r) { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
73 return decodeURIComponent(r.args.foo); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
74 } |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
75 |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
76 export default {decoded_foo}; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
77 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
78 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
79 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
80 </section> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
81 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
82 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
83 <section id="urlencode" name="Кодирование URL"> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
84 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
85 <para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
86 <path>nginx.conf</path>: |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
87 <example> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
88 js_import http.js; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
89 |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
90 js_set $encoded_foo http.encoded_foo; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
91 ... |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
92 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
93 location / { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
94 proxy_pass http://example.com?foo=$encoded_foo; |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
95 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
96 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
97 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
98 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
99 <para> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
100 <path>http.js</path>: |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
101 <example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
102 function encoded_foo(r) { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
103 return encodeURIComponent('foo & bar?'); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
104 } |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
105 |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
106 export default {encoded_foo}; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
107 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
108 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
109 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
110 </section> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
111 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
112 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
113 <section id="redirect" name="Внутренняя переадресация"> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
114 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
115 <para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
116 <path>nginx.conf</path>: |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
117 <example> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
118 js_import http.js; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
119 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
120 location /redirect { |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
121 js_content http.redirect; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
122 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
123 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
124 location @named { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
125 return 200 named; |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
126 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
127 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
128 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
129 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
130 <para> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
131 <path>http.js</path>: |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
132 <example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
133 function redirect(r) { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
134 r.internalRedirect('@named'); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
135 } |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
136 |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
137 export default {redirect}; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
138 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
139 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
140 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
141 </section> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
142 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
143 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
144 <section id="fast_response" name="Возвращение самого быстрого ответа от прокси"> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
145 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
146 <para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
147 <path>nginx.conf</path>: |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
148 <example> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
149 js_import http.js; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
150 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
151 location /start { |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
152 js_content http.content; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
153 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
154 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
155 location /foo { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
156 proxy_pass http://backend1; |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
157 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
158 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
159 location /bar { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
160 proxy_pass http://backend2; |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
161 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
162 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
163 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
164 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
165 <para> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
166 <path>http.js</path>: |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
167 <example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
168 function content(r) { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
169 var n = 0; |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
170 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
171 function done(res) { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
172 if (n++ == 0) { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
173 r.return(res.status, res.responseBody); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
174 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
175 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
176 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
177 r.subrequest('/foo', r.variables.args, done); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
178 r.subrequest('/bar', r.variables.args, done); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
179 } |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
180 |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
181 export default {content}; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
182 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
183 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
184 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
185 </section> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
186 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
187 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
188 <section id="jwt" name="Создание HS JWT"> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
189 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
190 <para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
191 <path>nginx.conf</path>: |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
192 <example> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
193 js_import http.js; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
194 |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
195 js_set $jwt http.jwt; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
196 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
197 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
198 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
199 <para> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
200 <path>http.js</path>: |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
201 <example> |
2519
1cd0abf8f1e5
Updated JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2517
diff
changeset
|
202 function generate_hs256_jwt(claims, key, valid) { |
2527
351a669a576d
Corrected JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2520
diff
changeset
|
203 var header = { typ: "JWT", alg: "HS256" }; |
351a669a576d
Corrected JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2520
diff
changeset
|
204 var claims = Object.assign(claims, {exp: Math.floor(Date.now()/1000) + valid}); |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
205 |
2519
1cd0abf8f1e5
Updated JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2517
diff
changeset
|
206 var s = [header, claims].map(JSON.stringify) |
2527
351a669a576d
Corrected JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2520
diff
changeset
|
207 .map(v=>v.toUTF8()) |
2519
1cd0abf8f1e5
Updated JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2517
diff
changeset
|
208 .map(v=>v.toString('base64url')) |
1cd0abf8f1e5
Updated JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2517
diff
changeset
|
209 .join('.'); |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
210 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
211 var h = require('crypto').createHmac('sha256', key); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
212 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
213 return s + '.' + h.update(s).digest().toString('base64url'); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
214 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
215 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
216 function jwt(r) { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
217 var claims = { |
2519
1cd0abf8f1e5
Updated JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2517
diff
changeset
|
218 iss: "nginx", |
1cd0abf8f1e5
Updated JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2517
diff
changeset
|
219 sub: "alice", |
1cd0abf8f1e5
Updated JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2517
diff
changeset
|
220 foo: 123, |
1cd0abf8f1e5
Updated JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2517
diff
changeset
|
221 bar: "qq", |
1cd0abf8f1e5
Updated JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2517
diff
changeset
|
222 zyx: false |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
223 }; |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
224 |
2519
1cd0abf8f1e5
Updated JWT example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2517
diff
changeset
|
225 return generate_hs256_jwt(claims, 'foo', 600); |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
226 } |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
227 |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
228 export default {jwt}; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
229 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
230 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
231 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
232 </section> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
233 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
234 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
235 <section id="subrequest" name="Доступ к API из подзапроса"> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
236 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
237 <para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
238 <path>nginx.conf</path>: |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
239 <example> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
240 js_import http.js; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
241 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
242 keyval_zone zone=foo:10m; |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
243 ... |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
244 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
245 location /keyval { |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
246 js_content http.set_keyval; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
247 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
248 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
249 location /version { |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
250 js_content http.version; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
251 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
252 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
253 location /api { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
254 api write=on; |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
255 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
256 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
257 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
258 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
259 <para> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
260 <path>http.js</path>: |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
261 <example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
262 function set_keyval(r) { |
2438
86b0dd6e7208
Updated API version in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2433
diff
changeset
|
263 r.subrequest('/api/5/http/keyvals/foo', |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
264 { method: 'POST', |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
265 body: JSON.stringify({ foo: 789, bar: "ss dd 00" })}, |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
266 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
267 function(res) { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
268 if (res.status >= 300) { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
269 r.return(res.status, res.responseBody); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
270 return; |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
271 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
272 r.return(500); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
273 }); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
274 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
275 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
276 function version(r) { |
2438
86b0dd6e7208
Updated API version in njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2433
diff
changeset
|
277 r.subrequest('/api/5/nginx', { method: 'GET' }, function(res) { |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
278 if (res.status != 200) { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
279 r.return(res.status); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
280 return; |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
281 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
282 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
283 var json = JSON.parse(res.responseBody); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
284 r.return(200, json.version); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
285 }); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
286 } |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
287 |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
288 export default {set_keyval, version}; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
289 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
290 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
291 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
292 </section> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
293 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
294 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
295 <section id="secure_link" name="Создание secure_link хэша"> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
296 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
297 <para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
298 <path>nginx.conf</path>: |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
299 <example> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
300 js_import http.js; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
301 |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
302 js_set $new_foo http.create_secure_link; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
303 ... |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
304 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
305 location / { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
306 secure_link $cookie_foo; |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
307 secure_link_md5 "$uri mykey"; |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
308 ... |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
309 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
310 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
311 location @login { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
312 add_header Set-Cookie "foo=$new_foo; Max-Age=60"; |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
313 return 302 /; |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
314 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
315 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
316 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
317 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
318 <para> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
319 <path>http.js</path>: |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
320 <example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
321 function create_secure_link(r) { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
322 return require('crypto').createHash('md5') |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
323 .update(r.uri).update(" mykey") |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
324 .digest('base64url'); |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
325 } |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
326 |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
327 export default {create_secure_link}; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
328 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
329 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
330 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
331 </section> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
332 |
2454
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
333 |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
334 <section id="requests" name="Запись в лог количества запросов от клиента"> |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
335 |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
336 <para> |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
337 <path>nginx.conf</path>: |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
338 <example> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
339 js_import http.js; |
2454
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
340 |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
341 js_set $num_requests http.num_requests; |
2454
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
342 |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
343 keyval_zone zone=foo:10m; |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
344 |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
345 keyval $remote_addr $foo zone=foo; |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
346 |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
347 log_format bar '$remote_addr [$time_local] $num_requests'; |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
348 access_log logs/access.log bar; |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
349 |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
350 server { |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
351 listen 8000; |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
352 |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
353 location / { |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
354 root html; |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
355 } |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
356 } |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
357 </example> |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
358 </para> |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
359 |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
360 <para> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
361 <path>http.js</path>: |
2454
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
362 <example> |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
363 function num_requests(r) |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
364 { |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
365 var n = r.variables.foo; |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
366 n = n ? Number(n) + 1 : 1; |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
367 r.variables.foo = n; |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
368 return n; |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
369 } |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
370 |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
371 export default {num_requests}; |
2454
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
372 </example> |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
373 <note> |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
374 Директивы <link doc="../http/ngx_http_keyval_module.xml" id="keyval"/> и |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
375 <link doc="../http/ngx_http_keyval_module.xml" id="keyval_zone"/> |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
376 доступны как часть |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
377 <commercial_version>коммерческой подписки</commercial_version>. |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
378 </note> |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
379 </para> |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
380 |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
381 </section> |
253641e268a8
Added js_requests.js example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2438
diff
changeset
|
382 |
2483
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
383 |
2517
ba9bfd064a61
Renamed and corrected example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2483
diff
changeset
|
384 <section id="subrequests_chaining" name="Построение цепочки подзапросов"> |
2483
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
385 |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
386 <para> |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
387 <path>nginx.conf</path>: |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
388 <example> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
389 js_import http.js; |
2483
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
390 |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
391 location /start { |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
392 js_content http.content; |
2483
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
393 } |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
394 |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
395 location /auth { |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
396 proxy_pass http://auth_backend; |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
397 } |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
398 |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
399 location /backend { |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
400 proxy_pass http://backend; |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
401 } |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
402 </example> |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
403 </para> |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
404 |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
405 <para> |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
406 <path>http.js</path>: |
2483
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
407 <example> |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
408 function content(r) { |
2517
ba9bfd064a61
Renamed and corrected example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2483
diff
changeset
|
409 r.subrequest('/auth') |
2483
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
410 .then(reply => JSON.parse(reply.responseBody)) |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
411 .then(response => { |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
412 if (!response['token']) { |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
413 throw new Error("token is not available"); |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
414 } |
2517
ba9bfd064a61
Renamed and corrected example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2483
diff
changeset
|
415 return reply['token']; |
2483
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
416 }) |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
417 .then(token => { |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
418 r.subrequest('/backend', `token=${token}`) |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
419 .then(reply => r.return(reply.status, reply.responseBody)); |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
420 }) |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
421 .catch(_ => r.return(500)); |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
422 } |
2531
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
423 |
9c8a89d3876f
Updated njs examples with js_import and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2527
diff
changeset
|
424 export default {content}; |
2483
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
425 </example> |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
426 </para> |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
427 |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
428 </section> |
b60e5be733cd
Added Example of promisified requests to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2454
diff
changeset
|
429 |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
430 </article> |