Arguments

nexl server hosts JavaScript files and exposes them via HTTP protocol.
JavaScript files contain JavaScript variables.
Arguments allow temporarily attach new ( or override existing ) JavaScript variables to JavaScript file via HTTP request to nexl server.
Arguments are just query string key=value pairs in HTTP request.

To provide arguments in nexl application click on "Arguments" button or press F8 ( see screenshot and explanation here ).

The URL located under the nexl expression field is automatically updated according to arguments you are entering in "Arguments" dialog window:
http://localhost:8080/myConf.js?expression=${test}&length=100&brand=X
Here the length=100 and brand=X are arguments. They reflect as JavaScript string variables in the myConf.js file.
If the myConf.js file contains those variables their values will be overridden.
If this file doesn't contain them they will be attached to the file.
File will remain unchanged, this action is stateless and affects only for the HTTP request.

Examples

Let's say we have a [info.js] file with the following content:
person = {
        name: 'John',
        age: 30
};

1. Resolving a person object and overriding person's age.

The following URL retrieves a person object from the [info.js] file:
http://localhost:8080/personal-data.js?expression=${person}
To override person's age we need to pass a [person.age=30] argument.
HTTP request URL will look like this:
http://localhost:8080/personal-data.js?expression=${person}&person.age=30
I.e. we replaced the person.age field with '30' string value in query string.

As you can see person.age is passed as string value. nexl allows to specify a primitive type for arguments.
There are following 3 primitive types you can apply:
:str ( by default )
:num
:bool
To apply a type just add it to the end of value. For example:
    http://localhost:8080/personal-data.js?expression=${person}&person.age=30:num

Additionally you can provide JavaScript null and undefined values via arguments.
Use the following postfixes for that:
:undefined ( or :u )
:null
For example:
http://localhost:8080/personal-data.js?expression=${person}&person.age=:undefined
If you need a semicolon to be a part of argument value, escape it in the following way:
person.age=30\:num
It equals to "30:num" string value.

2. Resolving a specific field from the person object.

Let's say we need to resolve dynamically person's object field provided as argument externally.

In the following screen shot we have a ${person.${field}} nexl expression and field=name argument:


The HTTP request URL looks like this:
http://localhost:8080/personal-data.js?expression=${person.${field}}&field=name
By providing the field in that query string you can dynamically resolve person object values.

Watch a demo