Hello World

In this example, we'll run a Node.js app that connects to your Cloud CMS tenant's Sample Web Site.

If you haven't yet signed up for Cloud CMS, give it a shot by signing up for a trial account.
Each trial comes with a Sample Web Site. That's what we'll use here.


For this tutorial, we require Node.js and the Cloud CMS command line interface. Steps 1 to 3 cover how to install these.
If you already have one or the other installed, feel free to skip ahead.

Step 1

Install Node.js

Node.js is a powerful JavaScript tool that does everything from power command-line tools to run entire web servers.
Install Node.js

Step 2

Install the Cloud CMS Command Line Tool

The Cloud CMS command line tool lets you interact and configure Cloud CMS from the command line. To install it, run:

npm install cloudcms-cli -g

Note: If you're in Linux (or Mac), you might have to run sudo npm install cloudcms-cli -g.

Step 3

Register the Command Line Tool

Open a command prompt and run:

cloudcms init

You'll be prompted for your Cloud CMS domain URL, your username and password. These are the ones that you created when you signed up for Cloud CMS.

Simply complete the prompts and your Command Line Interface will be connected to Cloud CMS!

Run Hello World!

Now that the requirements are out of the way, let's download and run the Hello World sample.

Step 4

Download the Cloud CMS SDK

The Cloud CMS SDK is provided as a GitHub repository that contains a whole bunch of samples including our little Hello World example.

If you have Git installed, you can run the following from the command line:

git clone https://github.com/gitana/sdk.git

This will pull down the SDK to your local machine.

You can also get the SDK using the GitHub Client for Mac or the GitHub Client for Windows.

Step 5

Connect Hello World to Cloud CMS

The Hello World app is a simple Node.js app called app.js. When it starts up, it looks for a gitana.json file which contains the API keys for your Cloud CMS application.

Let's connect Hello World to Cloud CMS by pulling down a copy of gitana.json.

cd sdk/helloworld
cloudcms connect

Pick the Sample Web Site application and default deployment.

When you are finished, you will have a gitana.json file sitting in your directory. Woot!

Step 6

Run the Application

The Hello World app is a simple Node.js app called app.js. When it starts up, it looks for a gitana.json file which contains the API keys for your Cloud CMS application.

Build the Node.js app:

npm install

Once built, you can start up your app!

node app

Hello World is pretty simple. It connects to Cloud CMS and queries for nodes of type guide:city (which are included in the sample project). It then prints out the JSON for any results that it finds.

The JSON might look something like this:

  "b10fb7104d01e4d2c0fa": {
    "title": "Barcelona",
    "description": "Barcelona, Spain",
    "state": "",
    "author": "Salvador Dali",
    "headline": "A beautiful City",
    "summary": "Barcelona is the capital of the autonomous community of Catalonia and the second largest city in Spain after Madrid with a population of 1,700 000 intra-muros when five million people live in the whole Barcelona metropolitan area. Barcelona is the largest metropolis on the Mediterranean Sea and the fourth economically powerful city by GDP in the European Union. Widely spoken Catalan and Spanish are both the official languages.",
    "body": "Barcelona is a huge city with several district articles containing sightseeing, restaurant, nightlife and accommodation listings — have a look at each of them. Barcelona is the capital and largest city of Catalonia and Spain's second largest city, with a population of over one and half million people (over five million in the whole province). This city, located directly on the northeastern Mediterranean coast of Spain, has a rich history, having been under Roman, then Frank law before declaring its independence. In 1992, Barcelona gained international recognition by hosting the Olympic games which brought a massive upturn in its tourism industry. This had the effect of changing the city in ways that are still felt today with neighbourhoods renovated (and in some cases leveled) and the intense focus of modern design permeating all aspects of life in Barcelona from public buildings to something as simple as a park bench or an event poster. For visitors, this has translated into the very modern, yet incredibly old city you see now in the 21st century, where the new elements work to both preserve and celebrate the ancient. This beautiful city is full of what European cities are known for (outdoor markets, restaurants, shops, museums and churches) and is fantastic for walking with an extensive and reliable Metro system for more far-flung destinations. The core centre of town, focused around the Ciutat Vella (Old City) provides days of enjoyment for those looking to experience the life of Barcelona while the beaches the city was built upon provide sun and relaxation during the long periods of agreeably warm weather.",
    "highlights": [
      "Explore Gaudi and modernism",
      "Picture the city of Picasso's youth",
      "Fill up on tapas, pintxos and vermouth",
      "Take a dip in the Mediterranean",
      "Enjoy a really good party"
    "testimonials": [
        "text": "This place really makes me proud of my country!",
        "author": "Enrirue Iglesias"
        "text": "Great place to paint",
        "author": "Pablo Picasso"
    "loc": {
      "latitude": 38.8993487,
      "longitude": -77.0145665
    "_doc": "b10fb7104d01e4d2c0fa"

Congratulations! You've connected the Hello World app to Cloud CMS.

Feel free to dig into the app.js codebase and poke around at how it works. In the end, it's pretty simple - an XHR call behind some OAuth2 authentication. Not too shabby!