devweb


CIS Home

DEVWEB home

Apache, HTML, CGI and PHP
Servlets/JSP
NodeJS
Gitlab
Mattermost
Microsoft SQL
MySQL
PostgresQL
MongoDB
Elasticsearch
Shibboleth

 

NodeJS

Intructions for using NodeJS 10 LTS on devweb2019:

  1. these instructions are for someone using linux in our labs
  2. visit https://devweb2019.cis.strath.ac.uk/username-nodejs/ - remember to replace username with your one
    • this will give an proxy error but should create the nodejs setup required - the error occurs because you don't have a nodejs app yet
  3. create your empty app directory in /home/username/DEVWEB/2019/nodejs - e.g. mkdir testapp
    • you should put the name of you empty app directory in a plain text file called NODEJS in /home/username/DEVWEB/2019/nodejs
  4. run 'npm10 init' in your empty app directory - e.g. cd testapp; npm10 init
    • answer the questions......
  5. run npm10 install to install required modules (while in your app directory) - e.g. npm10 install ionic express cordova
  6. create your initial app
    • the app must be set to run on port 3000
    • the packages.json file must refer to the main file correctly, e.g. "main": "app.js",, otherwise the nodejs application will not start
    • to view your app goto https://devweb2019.cis.strath.ac.uk/username-nodejs/
    • you should also be able to test your app by running node locally - e.g. node10 testapp
      • you can then browse to http://localhost:3000/ to view it.
  7. when you need to restart your node application just run 'touch /home/username/DEVWEB/2019/nodejs/NODEJS' and it should restart within 30 seconds
  8. you can only have one nodejs app at a time
  9. the docker container, running your nodejs app, will stop running after 30 minutes (from when it was first started). It will, of course, restart upon next access. If you would prefer the stopping to happen 30 minutes after last access then make your app log to any file in /home/username/DEVWEB/2019/.logs/nodejs.
  10. NOTE: If you want to use NodeJS 12 then you must also create a file called NODEJSVERSION in /home/username/DEVWEB/2019/nodejs containing the number 12 only

back to top