A fresh work enviroment for Node.js and Express on Ubuntu 10 in about 30 minutes

Hello and welcome.

Node.js came to me as likely the smartest choice for web development, as you are constrained at JavaScript for dynamic programming server side (ActionScript and Java, please don’t cry). Having all String, and Date operations the same as server or client is just a big thing! Also validations come to my mind as not-anymore duplicated code. Besides, the concurrency performance seems really nice. (most importantly, people smarter then me thinks the same)

This post intention is to document my efforts under Ubuntu 10.04 to install everything needed from Node.js to the actual work environment.

Lets start by some git and a good working java for Aptana, and some dependencies for Node.js install itself.

sudo aptitude install git-core sun-java6-bin sun-java6-jre sun-java6-plugin sun-java6-jdk python libssl-dev socat curl libev

Now, you should be good to both install version 0.4x as referenced here: https://github.com/joyent/node/wiki/Installation and I also recommend you start dl Aptana Studio 3 this is my IDE of choice for web dev. (as Rails developer)

If you are new to Aptana, I also recommend going to Window > Preferences and choosing a theme(Aptana>Themes) you like, as well as configuring JS to not alert apparent errors(General>Editor>Texte Editor>Errors : uncheck boxes), since it does not know Node.js functions.

Install NPM, which is the best package handler at the moment and all packages to head into web dev, I will explain later on

curl http://npmjs.org/install.sh | sh
npm install jade
npm install less
npm install -g express
npm install -g node-dev
npm install -g node-inspector

About Express, you can have noticed, it is close to ruby’s Sinatra web framework MVC, which is pretty cool, and has a great performance. I recommend some learning from their web-site videos.

In my machine, AMD Phenom II X4 965, 3.2GB Ram (bla bla) running some intensive apache ab, I got these fantastic results:

ab -n 100000 -c 100 http://127.0.0.1:3000/

Document Path: /
Document Length: 11 bytes

Concurrency Level: 100
Time taken for tests: 10.789 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 13200000 bytes
HTML transferred: 1100000 bytes
Requests per second: 9268.48 [#/sec] (mean)
Time per request: 10.789 [ms] (mean)
Time per request: 0.108 [ms] (mean, across all concurrent requests)

Jade and Less are about the View layer

Now… node-dev and node-inspector.. CLASSY STUFF!

If you are used to developing Rails or Sinatra, you are used to have your code auto-reloaded (development-mode or shotgun), node-dev accomplishes just that! everytime you make any changes to any file.js from the current folder it will kill and restart your Node app for you; nice!

Now, node-inspector this it the coolest debug tool I’ve ever seen! And you can use it along with node-dev with no problem 🙂

You can learn more from then at their Github page

If you want to develop along with CouchDB, you should install it too.


sudo aptitude install automake spidermonkey-bin autoconf subversion-tools libtool help2man build-essential erlang erlang-manpages libicu38 libmozjs-dev wget libicu-dev libreadline5-dev checkinstall
sudo aptitude install couchdb
npm install cradle

If couch installed fine, you can see it via http://127.0.0.1:5984/_utils/index.html. And a daemon is started along with your machine every boot.

About cradle, they have a real good documentation at their website, you should start there.

And that’s it! Due aptitude and npm you can have it all done in about 30 min, heavily depending on your network connection. Good coding! 😀

Advertisements

2 thoughts on “A fresh work enviroment for Node.js and Express on Ubuntu 10 in about 30 minutes

  1. Pingback: Express: Links, News And Resources (2) « Angel ”Java” Lopez on Blog

  2. Pingback: Node.Js: Links, News And Resources (15) | Angel "Java" Lopez on Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s