To learn how to clone a GitHub repository, read this article.
A Simple CoffeeScript App in Cloud9 IDE
After cloning the project, you'll find three different files in the tree: server.js, app.coffee, and README.md.
The README.md file contains instructions to install coffee-script using the Node Package Manager. We integrated Node Package Manager into Cloud 9 IDE to enable users to install Node programs.
From the Cloud 9 IDE command line, type the following command to install the Coffeescript module:
npm install coffee-script
Next, let's have a look at the server.js file.
var app = require("./app"); app.listen(process.env.PORT);
The first line is the require() function, which is used to load the coffee-script module that you have just installed. On the second line, we declare the CoffeeScript file that contains your application. In the last line, we specify the port the server is listening to. When projects run within Cloud9 IDE, you must retrieve the port information using process.env.PORT.
Now, let's look at what the CoffeeScript file does.
It creates an HTTP server with a function that is called for each request. In the callback function, you create a response with a status code of 200 (indicating that the request was fulfilled successfully) and the message "Hello World". You use 'module.exports' to enable the server.js file to use the code in the CoffeeScript file.