Mercurial > hg > nginx-site
changeset 2174:3b782a679237
Mentioned njs CLI in "About njs".
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Tue, 05 Jun 2018 17:17:24 +0300 |
parents | 434c1961f5ed |
children | cd4889fdcfa4 |
files | xml/en/docs/njs_about.xml xml/ru/docs/njs_about.xml |
diffstat | 2 files changed, 88 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/xml/en/docs/njs_about.xml +++ b/xml/en/docs/njs_about.xml @@ -9,7 +9,7 @@ <article name="About njs" link="/en/docs/njs_about.html" lang="en" - rev="18"> + rev="19"> <section id="summary"> @@ -270,6 +270,8 @@ njs is available in two modules: Both modules are not built by default, they should be either compiled from the sources or installed as a Linux package. +In addition, the Linux package provides +njs command-line <link id="cli">utility</link>. </para> @@ -316,8 +318,49 @@ The modules can also be built as </example> </para> +<para> +To build only njs command-line <link id="cli">utility</link>, run +<literal>./configure</literal> and <literal>make njs</literal> commands +from njs root directory. +The utility is available as <literal>./build/njs</literal>. +</para> + </section> </section> + +<section id="cli" name="Command-line interface"> + +<para> +njs scripts development and debugging can be performed +from the command-line. +The command-line utility is available after the installation of +the Linux <link id="install_package">package</link> +or after building from the <link id="install_sources">sources</link>. +Compared to njs running inside nginx, +nginx objects +(<link doc="njs/njs_api.xml" id="http">HTTP</link> and +<link doc="njs/njs_api.xml" id="stream">Stream</link>) +are not available in the utility. +<example> +$ echo "2**3" | njs - +8 + +$ njs +>> var o = {a:[]} +undefined + +>> JSON.stringify(o, undefined,1) +{ + "a": [ + + ] +} +>> +</example> +</para> + +</section> + </article>
--- a/xml/ru/docs/njs_about.xml +++ b/xml/ru/docs/njs_about.xml @@ -9,7 +9,7 @@ <article name="Информация о njs" link="/ru/docs/njs_about.html" lang="ru" - rev="18"> + rev="19"> <section id="summary"> @@ -269,6 +269,8 @@ njs доступен в двух модулях: По умолчанию модули не собираются их необходимо собрать из исходного кода или установить из отдельного пакета Linux. +Кроме того, в пакете Linux предоставляется +<link id="cli">утилита</link> командной строки njs. </para> @@ -316,6 +318,47 @@ hg clone http://hg.nginx.org/njs </example> </para> +<para> +Чтобы собрать только <link id="cli">утилиту</link> командной строки njs +необходимо запустить +команды <literal>./configure</literal> и <literal>make njs</literal> +из корневого каталога. +Утилита доступна как <literal>./build/njs</literal>. +</para> + +</section> + + +<section id="cli" name="Интерфейс командной строки"> + +<para> +Создание и отладка njs-скриптов может осуществляться +в командной строке. +Утилита командной строки доступна после установки +<link id="install_package">пакета</link> Linux +или после сборки из <link id="install_sources">исходных файлов</link>. +В отличие от njs, запущенном внутри nginx, +в утилите недоступны объекты nginx +(<link doc="njs/njs_api.xml" id="http">HTTP</link> и +<link doc="njs/njs_api.xml" id="stream">Stream</link>). +<example> +$ echo "2**3" | njs - +8 + +$ njs +>> var o = {a:[]} +undefined + +>> JSON.stringify(o, undefined,1) +{ + "a": [ + + ] +} +>> +</example> +</para> + </section> </section>