A NodeJS server template for WebGL-based applications
NodeJS is required to be installed for this application. If you haven't install NodeJS, Node Version Manager (nvm) is the easiest way you can try:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
source ~/.bashrc
nvm install v10.13.0
The necessary packages for this application are listed in package.json
and server/package.json
(for server of course). Run the following commands to install and build those packages:
npm install
cd server && npm install
There are two .sh
scripts that runs and monitors the server and applications: server/run.sh
and watch.sh
, which corresponds to the application watch list in package.json
. Before you start the server or customize any of your own applications, you need to make sure the applications are corrected listed in the package.json
as the following example:
"scripts": {
"build": "mkdir -p ./client/build && browserify ./client/js/apps/Demo/Demo.js ./client/js/apps/Common/Common.js --standalone Base -o ./client/build/Bundle.js -t [ babelify --presets [ es2015 react ] ]",
"watch": "mkdir -p ./client/build && watchify ./client/js/apps/Demo/Demo.js ./client/js/apps/Common/Common.js --standalone Base -o ./client/build/Bundle.js -t [ babelify --presets [ es2015 react ] ] --debug --verbose"
}
Note that
./client/js/apps/Common/Common.js
must be included, because it handles basic communications between the server and the middleware.
Currently, there is only one ./client/js/apps/Demo/Demo.js
as the available application. Once the configuration is finished, you can add your own applications into the list.
Now we can start the server and let it host the applications:
cd server && bash run.sh
You can make changes to the application in client/js/apps
. But in order to make the changes effective afterwards, run the monitoring script for the applications:
bash watch.sh
The applications can be reached in browser at localhost:8081/apps/