When I bring express into my project and create a new express app, I start with these two lines of code
var express = require('express');
var app = express();
This seems to me like express
is a function that returns the app
object I've created. But later I am able to use express.static()
which makes me think that express
is an object with the method static
.
app.use(express.static('public'));
When I require express
it seems to log an object, so I'm curious how express()
returns something if it is an object? My final guess would be that express is a function, but because this is javascript, functions are objects and it can have properties as well? Are any of these close to accurate?