Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

102 lines (68 sloc) 3.645 kB

Hello World: A Tutorial

In this tutorial, you will write a simple "hello world" web application in Node.js, and then deploy it using jitsu, Nodejitsu's command line interface.

Before you get started, you should have node.js installed. If you are using a node.js version older than v0.6.0 (not recommended) you will also need to separately install Node Package Manager (npm).

Write A Server

Let's start with a very basic Node.js http server. Create a folder called myapp/ and then create a file inside the folder called server.js. Inside this file, write the following code:

// requires node's http module
var http = require('http');

// creates a new httpServer instance
http.createServer(function (req, res) {
  // this is the callback, or request handler for the httpServer

  // respond to the browser, write some headers so the 
  // browser knows what type of content we are sending
  res.writeHead(200, {'Content-Type': 'text/html'});

  // write some content to the browser that your user will see
  res.write('<h1>hello, i know nodejitsu.</h1>');

  // close the response
}).listen(8080); // the server will listen on port 8080

That's all the code you'll need for starters. Save your server and get ready to deploy!

Deploy with Jitsu

In this tutorial, we will use jitsu to deploy our "hello world" application. Jitsu is a Command Line Interface for using Nodejitsu's platform. We've designed jitsu to be suitable for command line beginners, but still be powerful and extensible enough for production usage. If you aren't a fan of the command line or don't have terminal access you can still do app deployments through the Nodejitsu Web Application.

If this is your first time deploying an application and you are eager to get started, we recommend using jitsu: it has a one line installer, it's self-documenting, and with it you'll be able to deploy your app in seconds. Plus, it's what's in the tutorial.


In order to install jitsu, open a terminal and type:

 [sudo] npm install jitsu -g

This command will install jitsu on your system; the -g makes npm install it globally, rather than as a local module.

After installation, run the jitsu command from your command line. Since it's your first time using jitsu, you will be prompted to log in with an existing account or to create a new account.

Once you've logged in, you can deploy your app immediately.

One Line Deployment

Open a terminal:

cd /home/me/myapp
jitsu deploy

This will create a new application snapshot, generate and/or update project metadata, and deploy the project in the current path to Nodejitsu. If it's your first deployment, you'll be prompted for some information such as your app's name, its nodejitsu subdomain, and its start script. It's really easy and we promise it will only take a few seconds.

prompt: subdomain (myapp): myapp
prompt: scripts.start (server.js): 
prompt: version (0.0.0): 

Now just open up your favorite browser, and go to If everything has been set up correctly, then you, too, are on the path of nodejitsu!

Jump to Line
Something went wrong with that request. Please try again.