Homesick App — Setting up a CoffeeScript-written Node.js project
Nov 10, 2014
This is part of an ongoing series of posts about Homesick, my bachelor project.
The server side is hosted here.
This is a great opportunity for me to learn both Node.js and get acquainted with server-side programming.
Having said that, I realize that using Node.js might be overkill for something that could be solved with a more low-level approach, but I want to learn Node.js, simple as that!
In order to install Node, you can either download an installer from their website or install it using your favorite package manager. Myself, I used Homebrew on OS X with the command $ brew install node.
As a part of my toolchain, I’m personally a huge fan of rake for setting up tasks.
Here’s the tasks I have set up at the moment:
``` ruby RakeFile https://github.com/ramonh/homesick-server/blob/master/Rakefile Source
task :coffee do puts ‘CoffeeScript compiled!’ if system ‘coffee -c -o js coffee’ end
task :run => [:coffee] do puts ‘Starting server’ system ‘node js/app.js’ end ```
Short and sweet. The first tasks just prints “CoffeeScript compiled!” if the command to compile is successful. The way the coffee command works is it looks at the .coffee files in the coffee folder, and compiles them into the js folder.