How to import external javascript library?


#1

Ok, my next big hurdle. How does one properly import external javascript code into the script.

I have seen “require” which give me a module callback error.
I have seen eval(include(“script.js”)) which throw a 500 error.

I put the scripts in the “scripts” folder in local storage via scp. I also uploaded them to the files directory under “files”.

So where is the secret directory and proper syntax to call an external library? Thanks.


#2

I put my scripts in the following directories:

./dreamfactory/scripts
./dreamfactory/htdocs/public/dreamfactory/dist/scripts
./dreamfactory/htdocs/public/dreamfactory/app/scripts

And still eval(include(‘base64.js’));
Gives me a 500 error!

Any help please please please


#3

Scripts should be loaded into htdocs/storage/scripting
If you installed with bitnami, you should already see lodash.js in that directory. Adding your script library to your custom scripts should be accomplished in a manner similar to loading in lodash, such as in the scripting examples.
http://54.85.210.143/DreamFactory/Tutorials/Server_Side_Scripting