What is the use of var app = express(); in the process of creating a Node.Js Application?

Viewed 8500

I am new to the world of Node.js.I am trying to learn through an example.I have encountered the following statements in the "app.js" .

  var express = require("express");----->1
  var app = express(); --------->2 

So I understand the first statement is to load express module .What is the need for second statement??

Inorder to load a MYSQL module in my app.js we use

 var mysql = require("MYSQL");

We access SQL properties by mysql.connect("") etc.

so why cannot we write "express.get()" instead of "app.get()"????

Why do we need var express = require("express");??

Any help would be highly appreciated.

2 Answers
Related