2013年3月18日 星期一

Install & start up nodejs on ubuntu


Download nodejs tar.gz from nodejs

$ unzip nodejs tar.gz
$ ./configure
$ sudo make install


That's it! You can do a little test to make sure that nodejs has been installed correctly

$ node -v


Now, we can add a simple server side source code named server.js like this

var http = require('http');

var server = http.createServer(function(req, res) {
  res.writeHead(200);
  res.end('Hello Http');
});
server.listen(8080); 
and start up this simple server by

node server.js

opening a browser and navigating to http://localhost:8080

Here is a good beginners guide

沒有留言:

張貼留言

Python Tkinter First Example

import tkinter as tk def on_closing():     root.destroy() class MainWindow(tk.Tk):     def __init__(self, *args, **kwargs):         tk.Tk.__...