Node JS Tutorials, Express Tutorials, NodeJS MySQL Tutorial, NodeJS Database tutorial, NodeJS Session

NodeJS Get HostName from request ExpressJS

Sometimes we need hostname to do various log activities. We can get the hostname from the request property in ExpressJS NodeJS. We have two options to get the hostname: hostname property of request header method of request Request HostName Property Below code is shown to get hostname from request object. app.get('/',(req, res) => { hostName = req.hostname; //dotnetpattern.com...

Continue Reading

NodeJS UUID Validate

To validate UUID (GUID) in NodeJS, we can use below options: UUID NPM Package We can write our own custom regular expressions to validate. 1. UUID NPM Package To use UUID package, we can use below command to include in our project. To validate UUID in NodeJS, we can use validate method of UUID package. Below is the sample code. const uuid = require('uuid'); const uniqueId = "3112b3db...

Continue Reading

NodeJS MySQL Tutorial

One of the main advantages of using the NodeJS framework is the easy integration with the Database libraries. MySQL is one of the most popular database. NPM MySQL library provides easy integration with NodeJS application. In this tutorial, we'll learn following operations from NodeJS application: Installing MySQL NPM module Connect to MySQL database Execute select quer...

Continue Reading