Tag Archives: linux

Diving into Node.js – Very First App

What do I have till now?

After Node.js is istalled, described in my previous post, I can simply run this command:

stoimenpopov:~# node server.js

and this will start the server with the code within server.js. But what’s the code of server.js?

Following the instructions of Node’s homepage and most of the tutorials I’ve found, I can simply copy/paste the code from the first lines of Node’s page:

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(8124, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8124/');

There are several things I find interesting in this code, making it different from JavaScript as we know it. First of all what is

var http = require(‘http’)

and why I need it? What is the purpouse of 8124 and 127.0.0.1?

Node is built in modules and to use one of them you must first include it with require. Just like the example above with require(‘http’). In the same manner you can include every module of Node.

What are the Node’s modules are pretty well described in the API page. Well I’d like to say that the API page is quite insufficient. That is very bad, cause most of the code you’ll need developing a node.js applicatoin isn’t described/explained there. Continue reading Diving into Node.js – Very First App

amarok plays mp3

I’m on Fedora 7. Due to lack of free time I just saw the Amarok is not playing mp3 files and solved the problem simply by installing the XMMS. Today, realizing that I’m using Konqueror all the day long and almost everything related to the file system, browsing etc. is performed by Konqueror, I decided to configure lastly my Amarok.

And as it appears I had good luck. I found this lovely article which I recommend to everyone who’s gonna configure his own player.