Node.JS, Cloud9, Express, and a Great Blog

Well I don’t know what got into me yesterday, but it was crummy weather and I was feeling bored and I suppose frustrated with Objective-C. So to give myself a break I decided to do something equally frustrating, but completely different – play around with a web framework written in (of all things) JavaScript – namely Node.js. Yeah – you heard me – if there’s one thing more annoying than Objective-C, it is JavaScript. Did you hear that Matt?

What is Node.js?

I’ve been messing around with PhoneGap (or whatever its called these days) and Titanium and in general a bunch of the “hybrid” mobile app frameworks. They all have something vaguely to do with programming in JavaScript. Through that work I stumbled on node.js and thought – hey that sounds interesting. That was a few weeks ago and this weekend I had some time to play aorund with it. Basically node.js is a web app platform built on top of the Chrome JavaScript runtime. Sound crazy? Yeah – well kinda. If you want a better source of knowledge (and you probably should want that) go over to these websites:

There are some great examples and tutorials, but really there is one tutorial that you should check out. It is easily one of the best tutorials I have ever read (including my own comparatively amateurish ramblings):

Great stuff – except for that one little link to that anti-Java rant/bash/ramble/sermon. Nouns and verbs – come on can’t we all get along? Personally I think there is a time and place for both. It just depends.

Installation, Getting Started, and then Cloud

So following the docs I grabbed the software, got it all installed, and got it up and running on my MacBook in a Node Server Startedsnap – I will have to warn all the PHP’ers reading this – yes it seems like the node server is similar to a Java server….get used to bouncing, bouncing, bouncing. On the good side the server starts up in less than 1 second on my MacBook Pro.How’s that for an impressive screenshot? CMSU.

I followed a few of the little examples and then started to look at the community sites and wondered – ok where’s a good tutorial – I mentioned it above. Do that next – it will save you a boat load of time and will give you a fairly comprehensive picture of the platform. I got through all of that and wondered, ok what now? How would I build a real website? What about an IDE? How can I combine regular web pages (HTML) with content served up by node.js?

I don’t normally do web or JS coding on my MacBook so I didn’t have a decent text editor. I found TextWrangler after a bit of searching for “Notepad++ OS-X”. Its free, small, and seems to do most basic things. Nice tool!

Cloud 9 IDEI did the same thing for an IDE and stumbled on Cloud9 – a SaaS/PaaS for node.js and it includes an on-line IDE. Amazing! For small users like me its even free! Super-cool! You can sign up for this service and you get a hosted development server plus an IDE to get you going. After about 30 seconds of thinking about “what if they steal all my cool ideas?”, I signed up and was up and running.

They provision out a demo workspace so you can see how things are setup and then you can create a new workspace for whatever you want to build. Free accounts are limited to how many workspaces you can create and a few other things. You can choose to keep your workspace private or share it for all the world to see. There are also options for various source code tools and what not. I skipped all that crap and just got to messing around. The demo app is a chat app – it started up right away and I was able to get connectedCloud 9 Workspace from my macbook and my ipad. The deployment URLs are provisioned by Cloud9 during workspace creation – then you can either code yourself or share access to the workspace with other folks.

Cloud9 had a brief introduction to Express, a web application framework written on top of node.js. I gave that a shot too – wow it worked! No small feat that all these things are working without any issues. Here’s a shot below of the IDE on-line with my running Express server. The console window is available and there is also a command line that you can use:

Running App and Console

 What’s Next with This?

Yeah so this is cool technology, but what’s the point with so many frameworks, servers, languages, and things out there? Well I’m not quite sure. I have a few open questions that I need to work through:

  1. How does this work with “regular” web pages and such – how difficult is it to integrate with static content?
  2. How does database connectivity work? I see some articles about mongo-db so I’m going to read those and I’m also going to explore and see what I can do with that.
  3. What is Express and can I build websites with it. Can I replace with the same functionality, but using node. Can I then start to build out some dynamic features with node.

Leave a Reply