Chapter 6. Web
6.1. npm
npm is the package manager for distributing JavaScript code. It is used to install the RHMAP JavaScript SDK for developing Cordova apps.
6.1.1. Installing Node.js and npm
You must have Node.js installed on your system to use npm. It is recommended that you install NodeJS version 4.x or later, which includes npm version 2.x by default.
6.1.1.1. Install Node.js Using a Package Manager
To install Node.js using your system package manager, follow the instructions appropriate for your system on the Node.js site
To check the version of npm you are currently using, execute the following command:
sudo npm -v
6.1.2. Installing Node.js and npm on Red Hat Enterprise Linux
To install NodeJS on systems running RHEL, you must obtain the installation files from the Red Hat Software Collections. Installing NodeJS requires a subscription to the Red Hat Subscription Manager.
To install NodeJS on RHEL, follow the guide on the Red Hat Developers Portal.
6.2. Introduction
This is a Node.js + Express web application. These apps provide more advanced desktop/tablet web portals and mobile websites.
They expose the full power of Node.js for web app development including functionality such as Express 4 and server side templating using template engines such as ejs.
They also support static file serving for standard HTML5, CSS and JavaScript.
6.3. New App
Download the sample app to get started with a new Web App which has the RHMAP SDK already included.
6.4. Existing App
Web Apps apps use our standard JavaScript SDK — included in the index.html file.
6.4.1. Download SDK
fh-js-sdk is distributed using npm. To be able to complete the steps below, you must install npm.
In the
/publicfolder of your app project, open thepackage.jsonfile and add the latest version offh-js-sdkonto the list of dependencies:"dependencies": { "fh-js-sdk": "^2.17.5", }In the root folder of your app, execute the following command to install the SDK:
sudo npm install fh-js-sdk
This installs the SDK version specified in the dependencies in the
package.jsonfile
6.4.2. Integrate SDK
Add the following code to your index.html file.
<head> <script src="feedhenry.js" type="text/javascript"></script> </head>
6.4.3. Set up Configuration
Create a new file in the same directory as the SDK file (feedhenry.js) called fhconfig.json, with the following contents:
{
"appid": "__ID_OF_APP_IN_PROJECT__",
"appkey": "__APP_API_KEY_OF_APP_IN_PROJECT__",
"connectiontag": "__CONNECTION_TAG_TO_USE_FOR_CLOUD__",
"host": "__APP_STUDIO_HOST__",
"projectid": "__PROJECT_ID__"
}More information on connections can be found here.
6.5. Use SDK
See API Docs for full details on the APIs available within the SDK.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.