Using express.static middleware in an authorized route
I'm using node with express and passportjs to restrict access to files located in a private folder. I have reduced my code to the following.
Everything in the public static folder works great but route targeting the private folder through the use of the staticMiddleware returns 404 errors.

    var express = require('express')
    ,   util = require('util');
 
    var app = express.createServer();
    var staticMiddleware = express.static(__dirname + '/private');

    app.configure(function() {
      app.use(app.router);
      app.use(express.logger('dev')); 
      app.use('/public',express.static(__dirname + '/public'));
    });

    app.get('/private/:file', function(req, res, next){
        console.log('about to send restricted file '+ req.params.file);
        staticMiddleware(req, res, next);
    });
    app.listen(16000);

I was using the following references that seems to work for others, so I must be missing something.
It won't work for me showing only 404 responses for the content located in the private area.

[http://stackoverflow.com/questions/7746180/node-js-module-specific-static-resources][1]

[http://stackoverflow.com/questions/9646406/nodejs-wont-serve-static-files-even-when-using-express-static][2]

[http://stackoverflow.com/questions/9457511/redirecting-to-a-static-file-in-express-js][3]


  [1]: http://stackoverflow.com/questions/7746180/node-js-module-specific-static-resources
  [2]: http://stackoverflow.com/questions/9646406/nodejs-wont-serve-static-files-even-when-using-express-static
  [3]: http://stackoverflow.com/questions/9457511/redirecting-to-a-static-file-in-express-js

I could have sworn I had this working before, maybe it was broken in a new version of something.

 - Node v0.8.1
 - npm 1.1.12
 - express@2.5.11
 - connect@1.9.2

Using express.static middleware in an authorized route
===

I'm using node with express and passportjs to restrict access to files located in a private folder. I have reduced my code to the following.
Everything in the public static folder works great but route targeting the private folder through the use of the staticMiddleware returns 404 errors.

    var express = require('express')
    ,   util = require('util');
 
    var app = express.createServer();
    var staticMiddleware = express.static(__dirname + '/private');

    app.configure(function() {
      app.use(app.router);
      app.use(express.logger('dev')); 
      app.use('/public',express.static(__dirname + '/public'));
    });

    app.get('/private/:file', function(req, res, next){
        console.log('about to send restricted file '+ req.params.file);
        staticMiddleware(req, res, next);
    });
    app.listen(16000);

I was using the following references that seems to work for others, so I must be missing something.
It won't work for me showing only 404 responses for the content located in the private area.

[http://stackoverflow.com/questions/7746180/node-js-module-specific-static-resources][1]

[http://stackoverflow.com/questions/9646406/nodejs-wont-serve-static-files-even-when-using-express-static][2]

[http://stackoverflow.com/questions/9457511/redirecting-to-a-static-file-in-express-js][3]


  [1]: http://stackoverflow.com/questions/7746180/node-js-module-specific-static-resources
  [2]: http://stackoverflow.com/questions/9646406/nodejs-wont-serve-static-files-even-when-using-express-static
  [3]: http://stackoverflow.com/questions/9457511/redirecting-to-a-static-file-in-express-js

I could have sworn I had this working before, maybe it was broken in a new version of something.

 - Node v0.8.1
 - npm 1.1.12
 - express@2.5.11
 - connect@1.9.2
