Creating Your Own NodeJs Modules
Each module has to follow this folder structure and include all of these files:
|—-config //folder contains the configuration file and the images
| |—-config.json
| |—-icon.png
| |__placeholder.png
|
|—-index.js //your main starting nodeJs application file
|__package.json //with the necessary npm packages listed in it
Please do not include the node_modules folder and the package-lock.json file of your application. The system will install all the necessary packages automatically.
Please also do not include any other files on any other folder level named the same as one of the required files. Any other file or folder name can be included.
The icon and the placeholder image has to be .png image file.
The configuration JSON file has to contain:
The system will automatically assign a PORT number for each module in its environment. This port can change dynamically with every restart.
If your application has web service functionality you need to run it on the value of the PORT environment variable, process.env.PORT .
var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World!'); }).listen(process.env.PORT);