How to...

Glue42 Enable Your App

Node.js

Initialization

If your Node.js script is started as a Glue42 application, you can initialize the Glue42 library without passing a configuration object to the factory function:

var Glue = require("@glue42/desktop");

Glue()  // no config object
    .then(function (glue) {
        console.log(glue.version);
        console.log(glue.interop.servers());
    }).catch(function (error) {
        console.error(error)
    });

If your Node.js script is started outside Glue42 Desktop, you have to pass a configuration object when initializing Glue42:

var Glue = require("@glue42/desktop");
var config = {
    application: "MyNodeApp",
    layouts: false,
    appManager: "full",
    logger: false,
    windows: false,
    gateway: {
        protocolVersion: 3,
        ws: process.env.gwURL
    },
    auth: {
        gatewayToken: process.env.gwToken
    }
}

Glue(config)
    .then(function (glue) {
        console.log(glue.version);
        console.log(glue.interop.servers());
    }).catch(function (error) {
        console.error(error)
    });

Application Configuration

To add your app to Glue42 Desktop, you need to create an application configuration .json file. You should place this file in the %LocalAppData%\Tick42\UserData\<REG-ENV>\apps folder. <REG-ENV> in the link should be replaced with the region and environment folder name used for the deployment of your Glue42 Desktop - e.g., T42-DEMO.

The following is an example configuration of a Node.js app:

{
    "title": "MyNodeServer",
    "name": "nodeServer",
    "caption": "Server description",
    "type": "node",
    "service": true,
    "details": {
        "path": "%GDDIR%/PathToMyServer",
        "showConsole": true
    }
}

The only property which is required is the path. It must lead to a .js file which will be executed by Node.js from Glue42 Desktop.

Reference

Reference