Build & Install node.js from source code
0
1 2 3 |
./configure make sudo make install |
1 2 3 4 |
~$ node > (^C again to quit) > |
Hello World Test!
1 |
console.log("Hello, World!") |
1 |
node hello.node.js |
1 |
vi http.test.js |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
var http = require("http"); http.createServer(function (request, response) { // Send HTTP Status: 200 : OK // Content Type: text/plain response.writeHead(200, {'Content-Type': 'text/plain'}); // Send the response body as "Hello World" response.end('Hello World\n'); }).listen(8888); // Console will print the message console.log('Server running at http://127.0.0.1:8888/'); |
1 2 |
On a Console: node http.test.js On a Web browser: http://127.0.0.1:8888 |