Reputation: 579
I know there is Node.js and Rhino, amongst other platforms to run server side JS. Though, we can only afford a shared server, since a VPS is much more expensive, and normally shared servers do not provide such tools. We need to run some cron jobs which by default are run by the server, and our core functions are purely JS without interaction with the browser/client.
Is there then a simple way of running server side JS, without the need for installing server side specific SW?
Upvotes: 2
Views: 1063
Reputation: 16243
1) Go to Node.js download page and get the link for the Linux Binaries (.tar.gz) (right click-> copy link address).
2) Then (thanks to user niutech) create the following php file, namely install_node.php
<?php
//Download and extract the latest node
exec('curl http://the_URL_you_copied | tar xz');
//Rename the folder for simplicity, adapt accordingly
exec('mv node-v#bla_bla-linux node');
?>
3) run the php file from the unix terminal
$php -q install_node.php
4) you may then run the node executable file on ./node/bin/node
Upvotes: 3