Category Archives: Node.js

Node.js.

File Handling In NodeJS

You must require the filesystem. var fs=require(‘fs’) var strCounterFileName  =   ‘/path/to/file/counter.txt’; fs.exists(strCounterFileName,function(exists){ if(exists){ // read file. fs.readFile(strCounterFileName, ‘utf8′, function (err,data) { if(err){ return console.log(“exist read:”+err); }else{ console.log(“Read counter From File :”+data); } });//   EOF File read }else{ // Create and … Continue reading

Posted in Node.js | Tagged | Leave a comment

Monitoring services with Monit

Monitoring services with Monit Check all running service on you machine with their port no, #netstat -atlpvn | grep LISTEN Get and install Monit, #sudo apt-get install monit OR #cd /home/ #wget http://mmonit.com/monit/dist/monit-5.5.tar.gz #tar -zxvf monit-5.5.tar.gz #cd monit-5.5 #./configure #make … Continue reading

Posted in Apache, Gearman, Memcached, MongoDB, Monit, Mysql, Node.js, Redis, Sphinx | Tagged , , , , , , , , | Leave a comment

Monitoring node.js with monit, upstart and forever.js

Monitoring Node with upstart, monit and forever.js When it comes time to have your Node project run more like a service, running in the background and auto-recovering from crashes, we can’t simply execute the node command manually from a shell. … Continue reading

Posted in Monit, Node.js | Tagged , , , , , | Leave a comment

Install node.js on centos

Check centos version #cat /etc/redhat-release CentOS release 5.8 (Final) Check centos 32 bit or 64 bit To see if the installed version of centOS you have is 32 bit or 64 bit, you need to use the command #uname -a … Continue reading

Posted in Node.js | Tagged , | Leave a comment

Connect redis with node.js

A Brief Intro to Async Programming In browsers, Javascript and the web page’s rendering engine share a single thread. The result of this is that only one thing can happen at a time. If a database query would be performed … Continue reading

Posted in Node.js, Redis | Tagged , , | Leave a comment

Connect mongodb with node.js

A Brief Intro to Async Programming In browsers, Javascript and the web page’s rendering engine share a single thread. The result of this is that only one thing can happen at a time. If a database query would be performed … Continue reading

Posted in MongoDB, Node.js | Tagged , , | Leave a comment

Connect mysql with node.js

A Brief Intro to Async Programming In browsers, Javascript and the web page’s rendering engine share a single thread. The result of this is that only one thing can happen at a time. If a database query would be performed … Continue reading

Posted in Mysql, Node.js | Tagged , , | Leave a comment

Connect socket.io with node.js

WebSocket with Socket.IO If you’ve stayed on top of the advances in the realtime web for the past few years, you’ve probably heard of different techniques aimed to reduce the latency (ie: speed) of the message exchange between a client … Continue reading

Posted in Node.js, Protocals | Tagged , , | Leave a comment

TCP Sockets Programming in Node.js

Programming TCP Sockets in Node.js Eager to know how sockets are programmed in Node? There are three variants of sockets in Node – i. TCP, ii. UDP, iii. UNIX domain. In this particular post, I will show you the basics … Continue reading

Posted in Node.js, Protocals, Web development | Tagged , | Leave a comment

Connect websocket to node.js

What is the WebSocket API? The WebSocket API is the next generation method of asynchronous communication from client to server. Communication takes place over single TCP socket using the ws (unsecure) or wss(secure) protocol and can be used by any client or server … Continue reading

Posted in Node.js, Protocals, Web development | Tagged , , | Leave a comment