HTTP JavaScript directives

js_import (http-js)

Registers a JavaScript module and optional alias.

Formal Syntax & Structure

nginx syntaxnginx
js_import [name from] file;

Parameters & Attributes

NameTypeDescription
fileJavaScript module fileModule exporting handlers; use trusted local files.
aliasidentifier followed by literal from before fileOptional namespace; use alias from file as a pair, otherwise filename-derived namespace.

Working Example

Example Snippetnginx
js_import app from handlers.js;
Nginx Reference