Quick node.js setup


1) install Node
cd node
git checkout v0.6.18 #Try checking nodejs.org for what the stable version is
./configure
make
sudo make install

2) install file upload helper library
npm install formidable

3) write a simple index.js file
var http = require("http");
var url = require("url");

function start(route, handle) {
function onRequest(request, response) {
var pathname = url.parse(request.url).pathname;
console.log("Request for " + pathname + " received.");
}

http.createServer(onRequest).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');
}
exports.start = start;

3) then run by typing in your command line
node index.js

4) view the app in the browser by going to:

This site has a really good explanation step by step guide at:

No comments:

Post a Comment