Category Archives: Node.js

All post related to Node.js


Socket.IO Connect   var io = require(‘’).listen(80); io.sockets.on(‘connection’, function (socket) { socket.on(‘message’, function (data) { console.log(data); }); }); on message need to parse and on send stringify. Managing Log Level   io.set(‘log level’, 1); Maintaining connection of same user with … Continue reading

Posted in Node.js | Leave a comment

Login form in node.js with session mangement

connect( connect.cookieParser() , connect.session({ secret: ‘keyboard cat’, cookie: { maxAge: 60000 }}) , connect.favicon() , function(req, res, next){ var sess = req.session; if (sess.views) { res.setHeader(‘Content-Type’, ‘text/html’); res.write(‘<p>views: ‘ + sess.views + ‘</p>’); res.write(‘<p>expires in: ‘ + (sess.cookie.maxAge / 1000) … Continue reading

Posted in Node.js | 2 Comments

advance query in mongodb

  db.collection.find({keyfieldtocheck:{ $exists : false }}) Ref :

Posted in lily, Node.js | Leave a comment

Installing node.js on ubuntu

Installing node.js on ubutnu step 3a ) Installing on Unix (including BSD and Mac) sudo apt-get install git git clone git:// to install particular version we want the stable one. cd node git checkout v0.4.11 # optional.  Note that … Continue reading

Posted in Node.js | Leave a comment

Installing Monit on ubuntu

sudo emacs  /etc/monit/monitrc sudo /etc/init.d/monit start sudo monit status Ref : This screenshot was really helpful : I got this code from above screen shot : /etc/monit/monitrc file I used: set daemon 20 set logfile /var/log/monit.log … Continue reading

Posted in Node.js, Ubuntu/Linux | Leave a comment

how to make api server and call an api from node.js

making server for api interface var sys = require(“sys”), http = require(“http”), url = require(“url”); http.createServer(function(request, responsehttp) { responsehttp.writeHead(200, {“Content-Type”: “text/html”}); console.log(request.url); var url_parts = url.parse(request.url, true); var query = url_parts.query; console.log(query); var msg={ ‘success’:true, ‘message’:’your request is sent to … Continue reading

Posted in Node.js | Leave a comment

installing nvm

  First you’ll need to make sure your system has a c++ compiler. For OSX, XCode will work, for Ubuntu, the build-essential and libssl-dev packages work. To install create a folder somewhere in your filesystem with the “” file inside … Continue reading

Posted in Node.js | Leave a comment

how can I install v.6.x of by NPM now?

npm ls  sudo npm install Ref :        

Posted in Node.js | Leave a comment

implementing ineheritance in javascript and how inheritance is implemented in a language

understanding javascript with node.js   Ref :

Posted in Node.js, UI Js | Leave a comment

how to handle closure in node.js

server.getchannel are closures over the i variable (well, over everything in scope, but it’s i we’re concerned with). They get an enduring reference to i, not a copy of its value as of when the function was created. That means when the function runs, it uses the current value of i, not the … Continue reading

Posted in Node.js | Leave a comment