Getting Started

To use this book effectively to learn to develop applications, you will need a few tools: a machine, an editor, a browser, etc. One of the good things about this approach is that you have a lot of latitude.

Questions?

I would encourage you to email any questions you have about this book to danceswithdolphin@gmail.com. Please place the word “book” in the subject.

Machine

You may choose to develop on just about any machine: Windows, Mac, Linux, Raspberry PI. I am using a HP Windows 10 laptop as I write this and develop the sample applications. It all works pretty much the same way on any of the other platforms. I suspect that most of my readers will be on either Windows or OS X. I will endeavor to point out differences within the text where differences exist.

Program Editor

Your choice is somewhat contingent on your choice of platform. I personally use VIM which is available on all the platforms. On Windows I use the GVIM variant. This is available for download for a variety of platforms here. Basically, any text editor will do. I have been using VIM for years in the Linux and Windows environments. The handy features an editor should have are syntax coloring, matching parenthesis and brace highlighting, search and replace, and differencing.

GIT

GIT is a version control system that has become insanely popular. You will use it in this book to download the samples for this book and to push your projects to the heroku server if you wish to share your application on-line so that you can show off your handiwork to others. You can download it here.

Chrome Browser

Your web browser includes the javascript interpreter which will execute all of your client side logic. I use Chrome to have access to an up to date version of HTML5 and javascript (which is still a rapidly evolving language). The Chrome javascript engine is also at the heart of Node.js (see below) which is the engine that drives server side logic and provides access to your file system. Thus by using Chrome, you have the same engine driving both the client and server side logic. In theory, you can use any recent version of another browser. But I prefer Chrome because it has built in developer tools which are very useful in debugging your code. You can download chrome here.

Node.js

As mentioned above, your server side logic will be executed by the javascript engine within node. Node consists of three parts: node, npm, and the Node.js Command prompt. Node is the javascript engine. Npm is the node package manager. Node.js command prompt is the command window within which you issue node, npm, and native commands. As of this writing, the most recent version of node (v6.11.1) does not include a separate command component. For window, you simply use the “cmd” shell. Node may be downloaded here.

Express

Express is a npm package which provides web server functionality to node. I will detail the express installation in the sample program. It is installed within the Node.js Command prompt with the npm install command.

Heroku

Heroku is a web hosting provider which provides free web hosting to newbies. If your application becomes insanely popular, you may become a paid subscriber and scale up the number of servers running your code to meet your demand. Heroku is here. You can postpone setting up your account until the first sample application is working locally.

Download The Sample Applications

Open the Node.js Command Window. On Windows 10, type “cmd” in the “Ask me anything” box. Select “Node.js command prompt” or “Command Prompt” (v6.11.1).

Now create or select a directory on your machine where you want the sample code to live, for example “C:Users\joe\Documents” (joe happens to be my username). “mysample” is the name of the subdirectory to be created for the cloned project.

  • Then, at the “Node.js command prompt, type the following:
      cd Documents
      git clone https://git.heroku.com/jrb-sampleapp.git mysample
      cd mysample
      node server.js
    
  • Your output should look something like this:
      C:\Users\joe>cd Documents
      C:\Users\joe\Documents>git clone  https://git.heroku.com/jrb-sampleapp.git mys\
    ample
      Cloning into 'mysample'...
      remote: Counting objects: 452, done.
      remote: Compressing objects: 100% (323/323), done.
      Receiving objects:  82% (371/452)    419 (delta 75)     eceiving objects:  81%\
     (367/452)
      Receiving objects: 100% (452/452), 346.32 KiB | 0 bytes/s,    done.
      Resolving deltas: 100% (86/86), done.
      Checking connectivity... done.
      C:\Users\joe\Documents>cd mysample
      C:\Users\joe\Documents\mysample>node server.js
      Node app is running on port 5000
    

Open your browser and type “localhost:5000” to view the application window. You are now running the application off-line in your browser. At this point you can play with the sample application to your hearts content. You may skip forward to the testing sections in the following chapters and run the tests here to develop an understanding of the applications. Explore the source code to see how much of it makes sense intuitively.

In the following chapters we will build the apps in another directory step by step.

At the end of the book you will understand how to build applications with these tools.