My static file middleware calls are being overwritten by my routes, even though I'm running it in the correct order:
First I set my static files, like this:
app.use('/public/', express.static('/home/skerit/temp'));
app.use('/public/', express.static('/home/skerit/app/public'));
Then I add my route:
app.get('/:controller/:action', callback);
And now, when I try to get /public/empty.txt the route is executed. When I remove the route, it works just fine.
And I'm sure they happen in the correct order. (First app.use, then app.get)
So what could be wrong here?
Edit: Since I said I'm executing them in the correct order, here's some proof. I added simple log statements to the execution of the code:
[debug] - [stages.js:186] Static middleware has been set! [debug] - [stages.js:191] Startin routes! [debug] - [routes.js:7] Setting controller routes [info] - [database.js:79] Database connection to default has been made [info] - [database.js:93] Stored procedures on MongoDB server default [info] - [database.js:120] Created connection to all datasources [debug] - [stages.js:202] Setting /:controller/:action
As you can see: 'Static middleware has been set' comes up first. Only then does it start setting the other routes.