mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 12:19:51 +01:00
docs
This commit is contained in:
parent
1b34fd7efa
commit
b9872a278f
|
|
@ -1,7 +1,4 @@
|
|||
|
||||
// Expose modules in ./support for demo purposes
|
||||
require.paths.unshift(__dirname + '/../../support');
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
|
@ -24,13 +21,15 @@ app.get('/files/:file(*)', function(req, res, next){
|
|||
, path = __dirname + '/files/' + file;
|
||||
// either res.download(path) and let
|
||||
// express handle failures, or provide
|
||||
// a callback
|
||||
// a callback as shown below
|
||||
res.download(path, function(err){
|
||||
if (err) return next(err);
|
||||
// the response has invoked .end()
|
||||
// so you cannnot respond here (of course)
|
||||
// but the callback is handy for statistics etc.
|
||||
console.log('transferred %s', path);
|
||||
}, function(err){
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user