njs scripting language

njs is a subset of the JavaScript language that allows extending nginx functionality. njs is created in compliance with ECMAScript 5.1 (strict mode) with some ECMAScript 6 and later extensions. The compliance is still evolving.

Use cases

See examples for more njs use cases.

Basic HTTP Example

To use njs in nginx:

There is also a standalone command line utility that can be used independently of nginx for njs development and debugging.

Tested OS and platforms

Presentation at nginx.conf 2018