I came across a situation today where I needed a single Javascript file to be accessible through HTTP. The actual program was running with NodeJS and was outside of the /home/ directory.
The reason I was trying to access the javascript file was it has a list of functions that I use often, and wanted to utilize them with PhantomJS (essentially injecting it into a different website).
I was able to get it to work by moving the entire node into an accessible folder and having htaccess deny access to everything except 1 file, but I am curious if anyone would know:
Would it be possible to take an entire object (functions and preset values) and output them as a string (same as if you navigated to a file.js page). This way I could create an HTTP page, send the proper headers and essentially create an accessible JS page.
I looked around but couldn't find any information on actually outputting a object verbatim.