How can we help?

You are here:
< Back

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:
    “version“: {{version number of the module, has to be number}},
    “name“: {{name_of_the_module, has to be unique and cannot contain special characters or white spaces}},
    “display_name“: {{optional, this is how your custom widget will be called in the content editor, has to be unique and cannot contain special characters or white spaces}},
    “max_memory_restart“: {{The maximum memory usage of the module, like: “100M” for 100 megabites}},
    “description“: {{the description of the module}},
    “queryParams“: {{the query parameters of the module, Array of customWidgetSettings objects}},
    “endpoint“: {{the main route of the application if it has one, like: “/static/index.html“}},
    “isWidget“: {{false or true if the module is a widget and should appear in the content editor as a custom element}}
    “customParams“: {{the custom parameters of the module, Array of customWidgetParameters objects}},
See more about Editor integration and the custom parameters here.

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!');
You can download a sample module here.