Tuesday, September 23, 2014

In ExpressJS it Appears that Order Matters

In my expressjs app if I have code in this order everything is good:
app.use(express.static(path.join(__dirname, 'public')));

// uncomment after placing your favicon in /public
app.use(session({ secret: 'secret',  cookie: { httpOnly: false },
    saveUninitialized: true,
    resave: true} ));
However if I move the 'use session' to before the 'use static' then the app waits 2 minutes before serving JavaScript files, not all JavaScript files and not the same files each time, just random JavaScript files

No comments: