Node.js Driver
Connect your Node applications to Cloud CMS

Current version: 1.0.323. Released Oct 27, 2022.
The Cloud CMS NodeJS module can be included within any Node.js application so as to provide a helpful means of connecting and communicating with the Cloud CMS server.
To install the driver in your project, simply run the following command:
npm install gitana --save
This will install the gitana
module and also update your package.json
.
Then, to load the driver, simply require
it within your code:
var Gitana = require("gitana");
Gitana.connect({...}, function() {
// ...your code
});
Getting Started
To connect to Cloud CMS, you first need to have a set of API Keys. In Cloud CMS, API Keys consists of
a client key/secret and a user key/secret. You pass these keys into the Gitana.connect
method as a JSON object.
You can create as many API Keys as you would like. The basic process for getting your own keys is described in the Developers Getting Started Guide. Give that a shot and when you're done, you should have the following:
clientKey
clientSecret
username
password
You can then connect to Cloud CMS using a code block like the one shown below. Make sure to plug in the
values for clientKey
, clientSecret
, username
and password
from the API Keys that you generate.
var Gitana = require("gitana");
Gitana.connect({
"clientKey": "{clientKey}",
"clientSecret": "{clientSecret}",
"username": "{username}",
"password": "{password}",
"baseURL": "https://api.cloudcms.com"
}, function(err) {
// here is some sample code of what we might then do
// get the platform
var platform = this.platform();
// read a repository, get master branch
platform.readRepository("{repositoryId}").readBranch("master").then(function() {
// create a few nodes
this.createNode();
this.createNode({ "title": "My second node" });
this.createNode({ "title": "My third node", "name": "boo" });
// query for nodes
this.queryNodes({ "name": "boo" }).count(function(count) {
console.log("count = " + count); // 1
});
});
// create then delete a domain
this.createDomain({
"title": "Users and Groups"
}).del();
});
Documentation
The NodeJS driver is a very powerful library that provides access to 100% of the capabilities of Cloud CMS from a programmatic perspective. It is therefore important to first familiarize yourself with the concepts presented in the Cloud CMS Documentation.
You may also want to take a look at the Cloud CMS JavaScript driver which forms the core for the Node.js module.
Check out our Cloud CMS Node.js Cookbook for recipes and examples using the Node.js Driver.
And finally, you should familiarize with the Cloud CMS REST API which covers HTTP-level information about all of the methods and operations available within Cloud CMS.
Fork the Code
The Cloud CMS NodeJS driver is 100% open-source (Apache 2.0) and so you're free to fork it, extend it and dig into it to learn about how it works. We provide hundreds of test files and thousands of unit tests within that demonstrate various code operations. It's really cool.
Bugs / Problems
If you run into a bug, please create an issue
so that we can look at it.
For production support, please contact us at
support@cloudcms.com or call us directly.
Support and Terms of Use
The NodeJS driver is free to use in your applications and projects. It is fully supported by Cloud CMS.