comparison xml/en/docs/njs_about.xml @ 2174:3b782a679237

Mentioned njs CLI in "About njs".
author Yaroslav Zhuravlev <yar@nginx.com>
date Tue, 05 Jun 2018 17:17:24 +0300
parents af5751930f95
children cd4889fdcfa4
comparison
equal deleted inserted replaced
2173:434c1961f5ed 2174:3b782a679237
7 <!DOCTYPE article SYSTEM "../../../dtd/article.dtd"> 7 <!DOCTYPE article SYSTEM "../../../dtd/article.dtd">
8 8
9 <article name="About njs" 9 <article name="About njs"
10 link="/en/docs/njs_about.html" 10 link="/en/docs/njs_about.html"
11 lang="en" 11 lang="en"
12 rev="18"> 12 rev="19">
13 13
14 <section id="summary"> 14 <section id="summary">
15 15
16 <para> 16 <para>
17 njs is a subset of the JavaScript language that allows 17 njs is a subset of the JavaScript language that allows
268 268
269 </list> 269 </list>
270 Both modules are not built by default, 270 Both modules are not built by default,
271 they should be either compiled from the sources 271 they should be either compiled from the sources
272 or installed as a Linux package. 272 or installed as a Linux package.
273 In addition, the Linux package provides
274 njs command-line <link id="cli">utility</link>.
273 </para> 275 </para>
274 276
275 277
276 <section id="install_package" name="Installing as a Linux package"> 278 <section id="install_package" name="Installing as a Linux package">
277 <para> 279 <para>
314 <example> 316 <example>
315 ./configure --add-dynamic-module=<value>path-to-njs</value>/nginx 317 ./configure --add-dynamic-module=<value>path-to-njs</value>/nginx
316 </example> 318 </example>
317 </para> 319 </para>
318 320
319 </section> 321 <para>
322 To build only njs command-line <link id="cli">utility</link>, run
323 <literal>./configure</literal> and <literal>make njs</literal> commands
324 from njs root directory.
325 The utility is available as <literal>./build/njs</literal>.
326 </para>
327
328 </section>
329
330 </section>
331
332
333 <section id="cli" name="Command-line interface">
334
335 <para>
336 njs scripts development and debugging can be performed
337 from the command-line.
338 The command-line utility is available after the installation of
339 the Linux <link id="install_package">package</link>
340 or after building from the <link id="install_sources">sources</link>.
341 Compared to njs running inside nginx,
342 nginx objects
343 (<link doc="njs/njs_api.xml" id="http">HTTP</link> and
344 <link doc="njs/njs_api.xml" id="stream">Stream</link>)
345 are not available in the utility.
346 <example>
347 $ echo "2**3" | njs -
348 8
349
350 $ njs
351 >> var o = {a:[]}
352 undefined
353
354 >> JSON.stringify(o, undefined,1)
355 {
356 "a": [
357
358 ]
359 }
360 >>
361 </example>
362 </para>
320 363
321 </section> 364 </section>
322 365
323 </article> 366 </article>