Tuesday 14 March 2017

Instantiating express

I have an issue where I need to load express like this:

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

In order to get .static to work:

app.use(express.static(__dirname+'views'));

Any reason why I can't use shorthand:

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

When I try the short hand it says express.static is undefined and my script won't run. Is this just a feature that's not supported by express?



via allegory

No comments:

Post a Comment