Hosting the Todos example on Heroku

November 30th, 2011

Series Overview

<< An Example Backbone/Parse.com App

The Todos example was extremely easy to get up and running with Heroku.  Even though this is a CoffeeScript based server running with Node.js, Heroku can support the application.  I won’t go over the install process for the pre-requisites (Git and Heroku) because it is easy to find on the web.  Assuming they are installed, deploy the app like this:

Pull down the Todos example

> git clone git@github.com:BrianGenisio/todos-parseback.git

Create the Heroku app

> heroku create -s cedar yourappname
Creating yourappname… done, stack is cedar
http://yourappname.herokuapp.com/ | git@heroku.com:yourappname.git
Git remote heroku added

Create file: package.json

{
  "name": "yourappname",
  "version": "0.0.1",
  "dependencies": {
    "express": "2.5.0",
    "coffee-script": "1.1.3",
    "restler": "0.2.1"
  }
}

Install the packages locally (for testing)

> npm install

Configure and test the app

> cp config.coffee.example config.coffee

Edit config.coffee per the steps in the previous article and run it:

> coffee proxy.coffee

Point your browser to http://localhost:3001 and play.  Everything should be working right now locally.  Next, lets get it up on Heroku.

Create file: run.js

# Necessary because Heroku can’t run CoffeeScript directly
require("coffee-script");
require("./proxy.coffee");

Create file: Procfile

web: node run.js

Deploy to Heroku (via git)

> git add .

> git commit -m "Adding Heroku files"

[master 0154577] Adding Heroku files

3 files changed, 12 insertions(+), 0 deletions(-)

create mode 100644 Procfile

create mode 100644 package.json

create mode 100644 run.js

> git push heroku master

Counting objects: 23, done.

Delta compression using up to 4 threads.

Compressing objects: 100% (21/21), done.

Writing objects: 100% (23/23), 102.20 KiB, done.

Total 23 (delta 1), reused 17 (delta 0)

—–> Heroku receiving push

—–> Node.js app detected

—–> Fetching Node.js binaries

—–> Vendoring node 0.4.7

—–> Installing dependencies with npm 1.0.94

       restler@0.2.1 ./node_modules/restler

       coffee-script@1.1.3 ./node_modules/coffee-script

       express@2.5.0 ./node_modules/express

       ├── mkdirp@0.0.7

       ├── mime@1.2.4

       ├── qs@0.3.2

       └── connect@1.7.3

       Dependencies installed

—–> Discovering process types

       Procfile declares types -> web

—–> Compiled slug size is 3.4MB

—–> Launching… done, v4

       http://yourappname.herokuapp.com deployed to Heroku

To git@heroku.com:yourappname.git

* [new branch]      master –> master

Try it out

> heroku open

Opening
http://yourappname.herokuapp.com/

That’s it!

Seriously.  That was easy.  Now the app is hosted.  Heroku and Parse.com do all the dirty work for you.



An Example Backbone/Parse.com App

November 30th, 2011

Series Overview << Working with Backbone.js and the Parse.com Proxy    Hosting the Todos example on Heroku >> This is the post where I put it all together.  I showed how to create a proxy to use Parse.com as your data store.  I also showed how to modify Backbone Read More...

Working with Backbone.js and the Parse.com Proxy

November 9th, 2011

Series Overview << Making Backbone.js Work with Parse.com     An Example Backbone/Parse.com App >> In the last post, I presented some base prototypes for Backbone.js models and collections that play nicely with Parse.com Next, I will put all the pieces together and show how to use Backbone Read More...

Making Backbone.js Work with Parse.com

November 7th, 2011

Series Overview << A Proxy Server for Parse.com                  Working with Backbone.js and the Parse.com proxy >> In the previous post, I showed how you can create a minimal server that proxies requests on to Parse Read More...

A Proxy Server for Parse.com

November 7th, 2011

<< See the full series of posts          Making Backbone.js work with Parse.com >> In my previous post, I asked the question: “Is there any reason why can’t we use a service like [Parse.com] in an HTML5/Javascript single-paged app?”  The answer is “yes” Read More...

Going (Mostly) Server-less with Backbone.js

November 7th, 2011

I have been having a lot of fun with Backbone.js and CoffeeScript lately.  It is my new programming obsession.  They go together like chocolate and coffee.  Along with this work, I have had the fantasy of going server-less and pushing all of my data stores to a back-end that I don’t have to code or manage myself Read More...

Captive Runtime packaging in Air 3.0

October 11th, 2011

When I talk with people about the Flex framework, many think of it as a Flash library. They often refer to Flex as a web framework that runs in a plug-in. To me, however, Flex is an application framework. To be honest, Flex in the browser doesn’t excite me. I am much more interested in using Flex on the desktop or on mobile devices Read More...

Slides and Presentation for “Mobile Air” Presentation

May 6th, 2011

This morning, I presented at StirTrek 2011.  Here are my demos and presentation: Presentation Code Demos ScoreKeeper (Shared screens) Demo

Introducing Jasmine-Flex

April 5th, 2011

I have been developing software using Test Driven Development (TDD) for over three years now.  I usually use traditional xUnit style testing frameworks (NUnit, JUnit, jsUnit, FlexUnit, cppUnit, etc) because they are the most accessible frameworks out there. In reality, though, my TDD style has evolved into more of a Behavior Driven Development (BDD) style Read More...

Presentation Model and Multiple Screens (Flex)

March 24th, 2011

I put up another post to RiaRockstars.com recently. This time it is about the Presentation Model pattern and how it will aid you in developing for multiple screens (Phone, Tablet, Web, Desktop, etc). It is part 1 of 2 in a series I am co-authoring with Charlie Sears.