Concept of Node Modules
Node modules are simply javascript files containing some functions created for some specific tasks. Lets see an example
var http = require('http'), util = require('util'); var server = http.createServer(function (req,res){ util.log('Hello world'); res.end('Hello world'); }); server.listen(8080); util.log('Server listenning at localhost:8080');Here we have used the http module that has some functions like createServer(), listen() etc. These functions are used for some specific purpose. The util module is used for just showing message with the current timestamp.
Don't forget to check out our other node.js content!
Attached Files
Edited by Roger, 19 February 2013 - 02:45 PM.
added links