9951 explained code solutions for 126 technologies


nginxUsing NJs example


js_import /var/www/test.js;

server {
  location / {
    js_content http.test;
  }
}ctrl + c
js_import

Nginx NJs module directive that loads specified NJs file into Nginx

test.js

load NJs code file

server {

virtual server configuration block

location / {

default location block

js_content

return content from specified NJs function

http.test

will call test() function from NJs code file