Sunday, 16 April 2017

Express - understanding require()

In a simple javascript file, we can use express by adding these two lines of code at the beginning (after installing it through npm):

var express = require('express');
var app = express();

Now, according to the express API guide:

The app object conventionally denotes the Express application. Create it by calling the top-level express() function exported by the Express module

Since the app object is calling the top-level express() function, how come am I not able to just simply use:

var app = express.express;

Please forgive me if this makes absolutely no sense, I am just trying to connect dots in my head.



via Jeb_is_a_mess

No comments:

Post a Comment