andrewrk/connect-static

Middleware not called

ikb42 opened this issue · 1 comments

Being a bit new to Node I can't quite get it to work.
I can see that it scans the files and in theory caches them but it seems the middleware is never called in my setup.

I'm running this in my node server.js file:
createStatic({dir: "app"},
function(err, middleware) {
app.use('/', middleware);
});

Is that correct? Or should it be in my routes? If in my routes then what do I do with my default route for "/"?

I think you have to define your other endpoints (e.g. app.get(), app.post()) after you do app.use('/', middleware)