Today I finished Peepcode’s Full-Stack Node.JS Part 1. The tutorial walks through setting up a hypothetical bakery web-app, while covering the following topics:
The tutorial is a great supplement to my work in the Dynamic Web Development class at ITP. Here’s a couple things I picked up going through the tutorial:
Organizing routes into individualized “mini-app” directories is more precise and manageable than keeping everything in my server.js file.
It’s a good introduction to coding in CoffeeScript, a syntactically cleaner method to writing Javascript. CoffeeScript dynamically compiles to Javascript when the server runs. While CoffeeScript removes a lot of code and semi-colons, understanding how whitespace will affect your code took some time to get used to. Thankfully, Sublime Text 2 uses a TextMate CoffeeScript bundle to color-code functions and the like to know that your code is properly set.
Using the Jade template engine is explained very well, and a welcome replacement to Embedded JavaScript. Jade, like CoffeeScript, minimizes the amount of characters in your code, while keeping it clean with significant whitespace. (There’s a TextMate bundle for Jade as well.) Working in Jade feels more intuitive than using HTML with EJS - there’s less clutter from tags and brackets as well.
I should also note 2 spaces is equal to 1 indent for both CoffeeScript and Jade. This can be easily set in Sublime Text 2 in View > Indentation > Tab Size.
Standard helpers and dynamic helpers are explained well, from setting up the templates to the routes.
It was very helpful to build another webapp from the ground up and with the guidance of such a thoughtful walkthrough. I have already ordered Full-Stack Node.JS Part 2, and I will start tomorrow.