NodeJS on devweb #

These instructions assume that you are using Linux from a CIS lab, Cafe or a CPU node.

When your NodeJS container is auto-provisioned, an example app will be copied to your ~/DEVWEB/2022/nodejs folder. The example app will be called testapp.

You'll also find a file named NODEJS. This is the app server control file. The control file should contain one line with the name of the app folder; for the example app, the NODEJS file contains "testapp" (corresponding to the example app folder name).

If you want to retain the example app code and structure for reference, but also want to create a new app alongside it, you should:

mkdir ~/DEVWEB/2022/nodejs/mynewapp
cd ~/DEVWEB/2022/nodejs/mynewapp
npm18 init
npm18 install ionic express cordova
echo mynewapp >  ~/DEVWEB/2022/nodejs/NODEJS

You should be able to test your app by running node locally, e.g. node18 testapp. You can then browse to http://localhost:3000/ to view it; if you are working on cafe (rather than a lab PC or CPU node), you may need to create an ssh tunnel (e.g. ssh -L 3000:localhost:3000

Important notes #

Debugging issues #

If you've copied your code to your NodeJS folder but your app doesn't seem to be running, please check the logs in /home/$USER/DEVWEB/2022/.logs/nodejs for a clue as to what has gone wrong.