Difference between revisions of "Exports.conf"

From Lianjapedia
Jump to: navigation, search
(Created page with "The exports.conf file enables a simplified approach for calling server-side business procedures directly from the JavaScript client. This is accomplished by defining the libr...")
 
 
(9 intermediate revisions by 2 users not shown)
Line 6: Line 6:
 
<pre># This is an example exports.conf file
 
<pre># This is an example exports.conf file
 
#
 
#
# Each line describes a function that will be available directly from JavaScript code in the client
+
# Each line describes a function that will be available directly from JavaScript
 +
# code in the client
 
#
 
#
# library, function, type (source library, name of the function, language vfp or javascript)
+
# library, function, type
# (php and python will be added later)
+
# (source library, name of the function, type: vfp or javascript or Python )
 +
# (php will be added later)
 
#
 
#
 
# or
 
# or
 
#
 
#
# library, function (implied type of vfp)
+
# library, function  
 +
# (implied type of vfp)
 
#
 
#
 
# or
 
# or
 
#
 
#
# function (file expected to exist with a .dbo extension)
+
# function  
 +
# (file expected to exist with a .dbo extension)
 
#
 
#
 
mylib,myfunc1,vfp
 
mylib,myfunc1,vfp
 
myjslib,myfunc2,javascript
 
myjslib,myfunc2,javascript
myfunc3,vfp
+
myfunc3</pre>
myfunc4</pre>
+
  
Now in the App logic running in the Lianja JavaScript Web/Mobile App the server-side functions can be called directly:
+
In the Lianja JavaScript Web/Mobile App the server-side functions can be called directly:
  
 
<pre>// Note that arguments are automatically converted into the correct format for the  
 
<pre>// Note that arguments are automatically converted into the correct format for the  
Line 31: Line 34:
 
var result = myfunc1("hello world", 2015, true);
 
var result = myfunc1("hello world", 2015, true);
 
var result2 = myfunc2();
 
var result2 = myfunc2();
var result3 = myfunc3();
 
  
 
// When calling remote functions with objects as parameters the object is automatically  
 
// When calling remote functions with objects as parameters the object is automatically  
// converted to JSON and send base64 encoded
+
// converted to JSON and sent base64 encoded
 
// This allows you to send and receive complete JSON encoded objects between the  
 
// This allows you to send and receive complete JSON encoded objects between the  
 
// client and the server
 
// client and the server
var result4 = myfunc4( {"name":"barry", "company":"Lianja" });</pre>
+
var result3 = myfunc3( {"name":"barry", "company":"Lianja" });</pre>
[[Category:Cloud Server]]
+
 
 +
[[File:exports_conf.png|middle|768px|link={{filepath:exports_conf.png}}]]
 +
 
 +
[[Category:Lianja Cloud Server]]
 +
[[Category:JavaScript Scripting]]

Latest revision as of 11:56, 18 April 2021

The exports.conf file enables a simplified approach for calling server-side business procedures directly from the JavaScript client.

This is accomplished by defining the libraries, functions and scripting language for the functions in the exports.conf file which can reside in the app and/or the library directory.

Example exports.conf file:

# This is an example exports.conf file
#
# Each line describes a function that will be available directly from JavaScript
# code in the client
#
# library, function, type
# (source library, name of the function, type: vfp or javascript or Python )
# (php will be added later)
#
# or
#
# library, function 
# (implied type of vfp)
#
# or
#
# function 
# (file expected to exist with a .dbo extension)
#
mylib,myfunc1,vfp
myjslib,myfunc2,javascript
myfunc3

In the Lianja JavaScript Web/Mobile App the server-side functions can be called directly:

// Note that arguments are automatically converted into the correct format for the 
// remote function call and the function call is proxied
// using a synchronous  Lianja.evaluate() call
var result = myfunc1("hello world", 2015, true);
var result2 = myfunc2();

// When calling remote functions with objects as parameters the object is automatically 
// converted to JSON and sent base64 encoded
// This allows you to send and receive complete JSON encoded objects between the 
// client and the server
var result3 = myfunc3( {"name":"barry", "company":"Lianja" });

Exports conf.png