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
| Name | Type | Description |
|---|---|---|
| file | JavaScript module file | Module exporting handlers; use trusted local files. |
| alias | identifier followed by literal from before file | Optional namespace; use alias from file as a pair, otherwise filename-derived namespace. |
Working Example
Example Snippetnginx
js_import app from handlers.js;