Mercurial > hg > nginx-site
annotate xml/en/docs/njs/index.xml @ 2920:8033ffaedeb9
Documented automatic rotation of TLS ticket keys for stream/mail.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Thu, 22 Dec 2022 10:35:55 +0000 |
parents | 8831b3d9f332 |
children | bd8482c5a7fe |
rev | line source |
---|---|
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
1 <?xml version="1.0"?> |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
2 |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
3 <!-- |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
4 Copyright (C) Nginx, Inc. |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
5 --> |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
6 |
2244
467aef18bf12
Renamed the "About njs" page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2229
diff
changeset
|
7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd"> |
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
8 |
2244
467aef18bf12
Renamed the "About njs" page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2229
diff
changeset
|
9 <article name="njs scripting language" |
467aef18bf12
Renamed the "About njs" page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2229
diff
changeset
|
10 link="/en/docs/njs/index.html" |
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
11 lang="en" |
2804
8831b3d9f332
Moved njs Examples to GitHub.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2556
diff
changeset
|
12 rev="32" |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
13 toc="no"> |
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
14 |
2270
cd9934924920
Moved summary to top of njs index page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2263
diff
changeset
|
15 <section id="summary"> |
cd9934924920
Moved summary to top of njs index page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2263
diff
changeset
|
16 |
cd9934924920
Moved summary to top of njs index page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2263
diff
changeset
|
17 <para> |
cd9934924920
Moved summary to top of njs index page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2263
diff
changeset
|
18 njs is a subset of the JavaScript language that allows |
cd9934924920
Moved summary to top of njs index page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2263
diff
changeset
|
19 extending nginx functionality. |
cd9934924920
Moved summary to top of njs index page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2263
diff
changeset
|
20 njs is created in compliance with |
cd9934924920
Moved summary to top of njs index page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2263
diff
changeset
|
21 <link url="http://www.ecma-international.org/ecma-262/5.1/">ECMAScript 5.1</link> |
cd9934924920
Moved summary to top of njs index page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2263
diff
changeset
|
22 (strict mode) with some |
cd9934924920
Moved summary to top of njs index page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2263
diff
changeset
|
23 <link url="http://www.ecma-international.org/ecma-262/6.0/">ECMAScript 6</link> |
cd9934924920
Moved summary to top of njs index page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2263
diff
changeset
|
24 and later extensions. |
cd9934924920
Moved summary to top of njs index page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2263
diff
changeset
|
25 The compliance is still <link doc="compatibility.xml">evolving</link>. |
cd9934924920
Moved summary to top of njs index page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2263
diff
changeset
|
26 </para> |
cd9934924920
Moved summary to top of njs index page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2263
diff
changeset
|
27 |
cd9934924920
Moved summary to top of njs index page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2263
diff
changeset
|
28 </section> |
cd9934924920
Moved summary to top of njs index page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2263
diff
changeset
|
29 |
cd9934924920
Moved summary to top of njs index page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2263
diff
changeset
|
30 |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
31 <section id="links"> |
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
32 |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
33 <para> |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
34 <list type="bullet"> |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
35 |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
36 <listitem> |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
37 <link doc="install.xml"/> |
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
38 </listitem> |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
39 |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
40 <listitem> |
2246
32ba43abf9cd
Renamed njs API, njs Changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2245
diff
changeset
|
41 <link doc="changes.xml"/> |
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
42 </listitem> |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
43 |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
44 <listitem> |
2246
32ba43abf9cd
Renamed njs API, njs Changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2245
diff
changeset
|
45 <link doc="reference.xml"/> |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
46 </listitem> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
47 |
2004
d1a1253a570e
Documented Object methods, exponential and hex literals in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1955
diff
changeset
|
48 <listitem> |
2804
8831b3d9f332
Moved njs Examples to GitHub.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2556
diff
changeset
|
49 <link url="https://github.com/nginx/njs-examples/">Examples</link> |
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
50 </listitem> |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
51 |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
52 <listitem> |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
53 <link doc="compatibility.xml"/> |
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
54 </listitem> |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
55 |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
56 <listitem> |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
57 <link doc="cli.xml"/> |
2071
838c503fd2f7
Documented JSON object support for njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2026
diff
changeset
|
58 </listitem> |
838c503fd2f7
Documented JSON object support for njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2026
diff
changeset
|
59 |
2555
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
60 <listitem> |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
61 <link id="tested_os_and_platforms">Tested OS and platforms</link> |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
62 </listitem> |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
63 |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
64 </list> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
65 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
66 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
67 <para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
68 <list type="bullet"> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
69 |
2071
838c503fd2f7
Documented JSON object support for njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2026
diff
changeset
|
70 <listitem> |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
71 <link doc="../http/ngx_http_js_module.xml"> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
72 ngx_http_js_module</link> |
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
73 </listitem> |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
74 |
2076
07239ff77f50
Updated supported functionality for nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2071
diff
changeset
|
75 <listitem> |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
76 <link doc="../stream/ngx_stream_js_module.xml"> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
77 ngx_stream_js_module</link> |
2129
4212f4520070
Updated "About njs" with methods supported in njs-0.2.0.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2128
diff
changeset
|
78 </listitem> |
4212f4520070
Updated "About njs" with methods supported in njs-0.2.0.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2128
diff
changeset
|
79 |
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
80 </list> |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
81 </para> |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
82 |
2541
0e6bbd8138c4
Added article about TypeScript in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2480
diff
changeset
|
83 <para> |
0e6bbd8138c4
Added article about TypeScript in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2480
diff
changeset
|
84 <list type="bullet"> |
0e6bbd8138c4
Added article about TypeScript in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2480
diff
changeset
|
85 |
0e6bbd8138c4
Added article about TypeScript in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2480
diff
changeset
|
86 <listitem> |
0e6bbd8138c4
Added article about TypeScript in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2480
diff
changeset
|
87 <link doc="typescript.xml"/> |
0e6bbd8138c4
Added article about TypeScript in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2480
diff
changeset
|
88 </listitem> |
0e6bbd8138c4
Added article about TypeScript in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2480
diff
changeset
|
89 |
0e6bbd8138c4
Added article about TypeScript in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2480
diff
changeset
|
90 <listitem> |
0e6bbd8138c4
Added article about TypeScript in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2480
diff
changeset
|
91 <link doc="node_modules.xml"/> |
0e6bbd8138c4
Added article about TypeScript in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2480
diff
changeset
|
92 </listitem> |
0e6bbd8138c4
Added article about TypeScript in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2480
diff
changeset
|
93 |
0e6bbd8138c4
Added article about TypeScript in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2480
diff
changeset
|
94 </list> |
0e6bbd8138c4
Added article about TypeScript in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2480
diff
changeset
|
95 </para> |
0e6bbd8138c4
Added article about TypeScript in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2480
diff
changeset
|
96 |
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
97 </section> |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
98 |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
99 |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
100 <section id="usecases" name="Use cases"> |
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
101 |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
102 <para> |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
103 <list type="bullet"> |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
104 |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
105 <listitem> |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
106 Complex access control and security checks in njs |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
107 before a request reaches an upstream server |
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
108 </listitem> |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
109 |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
110 <listitem> |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
111 Manipulating response headers |
2150
af5751930f95
Described new Function() as not supported in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2148
diff
changeset
|
112 </listitem> |
af5751930f95
Described new Function() as not supported in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2148
diff
changeset
|
113 |
af5751930f95
Described new Function() as not supported in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2148
diff
changeset
|
114 <listitem> |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
115 Writing flexible asynchronous content handlers and filters |
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
116 </listitem> |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
117 |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
118 </list> |
2804
8831b3d9f332
Moved njs Examples to GitHub.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2556
diff
changeset
|
119 See <link url="https://github.com/nginx/njs-examples/">examples</link> and |
2280
dce69c8e4c7d
A link to the njs blogposts fixed.
Maxim Konovalov <maxim@nginx.com>
parents:
2270
diff
changeset
|
120 <link url="https://www.nginx.com/blog/tag/nginx-javascript-module/">blog posts</link> |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
121 for more njs use cases. |
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
122 </para> |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
123 |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
124 </section> |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
125 |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
126 |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
127 <section id="example" name="Basic HTTP Example"> |
2130 | 128 |
129 <para> | |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
130 To use njs in nginx: |
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
131 <list type="bullet"> |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
132 |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
133 <listitem> |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
134 <para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
135 <link doc="install.xml">install</link> njs scripting language |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
136 </para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
137 </listitem> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
138 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
139 <listitem id="hello_world"> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
140 <para> |
2556
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2555
diff
changeset
|
141 create an njs script file, for example, <path>http.js</path>. |
2246
32ba43abf9cd
Renamed njs API, njs Changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2245
diff
changeset
|
142 See <link doc="reference.xml">Reference</link> |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
143 for the list of njs properties and methods. |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
144 <example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
145 function hello(r) { |
2257
8cef5ef98336
Changed quotes to ASCII in NJS example.
Nick Shadrin <nick@nginx.com>
parents:
2246
diff
changeset
|
146 r.return(200, "Hello world!"); |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
147 } |
2556
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2555
diff
changeset
|
148 |
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2555
diff
changeset
|
149 export default {hello}; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
150 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
151 </para> |
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
152 </listitem> |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
153 |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
154 <listitem> |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
155 |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
156 <para> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
157 in the <path>nginx.conf</path> file, enable |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
158 <link doc="../http/ngx_http_js_module.xml">ngx_http_js_module</link> module |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
159 and specify the |
2556
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2555
diff
changeset
|
160 <link doc="../http/ngx_http_js_module.xml" id="js_import">js_import</link> |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
161 directive |
2556
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2555
diff
changeset
|
162 with the <path>http.js</path> script file: |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
163 <example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
164 load_module modules/ngx_http_js_module.so; |
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
165 |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
166 events {} |
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
167 |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
168 http { |
2556
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2555
diff
changeset
|
169 js_import http.js; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
170 |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
171 server { |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
172 listen 8000; |
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
173 |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
174 location / { |
2556
c81b1fadbcf3
Updated hello_world example in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2555
diff
changeset
|
175 js_content http.hello; |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
176 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
177 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
178 } |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
179 </example> |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
180 </para> |
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
181 </listitem> |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
182 |
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
183 </list> |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
184 There is also a standalone <link doc="cli.xml">command line</link> utility |
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
185 that can be used independently of nginx for njs development and debugging. |
2174
3b782a679237
Mentioned njs CLI in "About njs".
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2150
diff
changeset
|
186 </para> |
3b782a679237
Mentioned njs CLI in "About njs".
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2150
diff
changeset
|
187 |
3b782a679237
Mentioned njs CLI in "About njs".
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2150
diff
changeset
|
188 </section> |
3b782a679237
Mentioned njs CLI in "About njs".
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2150
diff
changeset
|
189 |
2263
1bec6f727a84
Added njs presentation from nginx.conf 2018.
Valentin Bartenev <vbart@nginx.com>
parents:
2257
diff
changeset
|
190 |
2555
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
191 <section id="tested_os_and_platforms" |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
192 name="Tested OS and platforms"> |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
193 |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
194 <para> |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
195 <list type="bullet"> |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
196 |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
197 <listitem> |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
198 FreeBSD / amd64; |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
199 </listitem> |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
200 |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
201 <listitem> |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
202 Linux / x86, amd64, arm64, ppc64el; |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
203 </listitem> |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
204 |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
205 <listitem> |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
206 Solaris 11 / amd64; |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
207 </listitem> |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
208 |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
209 <listitem> |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
210 macOS / x86_64; |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
211 </listitem> |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
212 |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
213 </list> |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
214 </para> |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
215 |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
216 </section> |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
217 |
5b2764724e0d
Added list of supported OSes to njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2541
diff
changeset
|
218 |
2263
1bec6f727a84
Added njs presentation from nginx.conf 2018.
Valentin Bartenev <vbart@nginx.com>
parents:
2257
diff
changeset
|
219 <section id="presentation" name="Presentation at nginx.conf 2018"> |
1bec6f727a84
Added njs presentation from nginx.conf 2018.
Valentin Bartenev <vbart@nginx.com>
parents:
2257
diff
changeset
|
220 |
1bec6f727a84
Added njs presentation from nginx.conf 2018.
Valentin Bartenev <vbart@nginx.com>
parents:
2257
diff
changeset
|
221 <para><video id="Jc_L6UffFOs" /></para> |
1bec6f727a84
Added njs presentation from nginx.conf 2018.
Valentin Bartenev <vbart@nginx.com>
parents:
2257
diff
changeset
|
222 |
1bec6f727a84
Added njs presentation from nginx.conf 2018.
Valentin Bartenev <vbart@nginx.com>
parents:
2257
diff
changeset
|
223 </section> |
1bec6f727a84
Added njs presentation from nginx.conf 2018.
Valentin Bartenev <vbart@nginx.com>
parents:
2257
diff
changeset
|
224 |
1846
bfac366fa1e4
Added article about nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
225 </article> |