Node.js on Windows

2011.11.04 v0.6.0 (stable)  node.exe :

1. Download node.exe from http://nodejs.org/#download 

2. Put this file into a folder, such as C:node

3. Create a file called example.js

and add this code:

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

4. Open cmd (not the exe)

5. Type cd C:node

6. Type node example.js

You’ll get the message Server running at http://127.0.0.1:1234/ and going to that link will show Hello World from Node

http://blog.grahamlicence.co.uk/post/Run-nodejs-in-windows.aspx

B logbook : PHP | Javascript | Laravel | CodeIgniter | VueJs | ReactJs | WordPress

Translate »