How to connect MySql database with Nodejs

Nodejs is a powerful platform which used for real-time data with flexible of handling data in file system or database side.  Today tutorial we are going to discuss about the connecting MySql with Nodejs.

Before getting into our code part, first will discuss about things needed for MySql connecting with Nodejs then will move to our code side.

First we need to check the MySql package is installed in our current Nodejs version or not. We have the command to check list or individual package installed in Nodejs. If the package is installed it will display the package else show “(empty)” value.

Display list of packages

Nodejs npm list command
Nodejs npm list command
Nodejs npm list packages
Nodejs npm list packages

Let’s see how to execute individual package and their output display. Continue reading “How to connect MySql database with Nodejs”

How to monitor connected and disconnect user IP Address in Nodejs

Nodejs have the ability to track the connected and disconnected user IP Address with node package.

What is ? enables real-time directions which is event based communication. Its works on all the platform, browser or device on reliability and speed. We need to check few package it’s installed or not.  if not you can install and ip both package from your terminal.

Installing package
Installing package
Installing ip package
Installing ip package

Once you have installed both the packages, let’s include our needed package into our code and create server where our code will on that port.

var app = require('http').createServer(handler),
	io = require('').listen(app),
	ip = require('ip');

handler function will print “Welcome” in browser. Continue reading “How to monitor connected and disconnect user IP Address in Nodejs”

Installing npm in NodeJs

NPM is node package manager for NodeJs, which is written fully in JavaScript. NPM runs on terminal or command line and manages dependencies if needed, when author include on the package.

npm logo

To install package just run the below command in terminal or command line. Continue reading “Installing npm in NodeJs”