Install Node.js and use hotnode

Install Node

Go and download the install package for your platform. I’ve done it with Mac, works like a charm.

http://nodejs.org/

Install hotnode

Alright then, any problems so far? Let’s now take a look at this “hotnode” thing.

hotnode auto-restarts your node server every time the .js file is saved so you don’t have to do it manually. It’s pretty handy if you’re developing.

sudo npm -g install hotnode

Here’s where the hotnode comes from: https://github.com/saschagehlich/hotnode

Is it working?

First of all create new file called whatever.js (I like mine to be server.js)

Run the hotnode command over your server.js file:

hotnode server.js

Alright, open your server.js with your favourite editor (please don’t say Dreamweaver) and paste the following code.

var http = require('http');
   http.createServer(function (request, response) {
   response.writeHead(200, {'Content-Type': 'text/html'});
   response.end('CodeGround rocks!');
 }).listen(8080);

Save.

The hotnode has restarted your node and you’re ready to test it.

Go to your browser and type localhost:8080

The code above basically listens to the :8080 port and prints ‘CodeGround rocks!’

Feedback

Did it work for you?

Are you interested in Node.js?

Would you like to see more tutorials about it?

Cheers ;)

No comments yet, leave yours!

Leave a Reply

Add <code> Some Code </code> by using this tags.