From ec75c3fbed5e16860d00c9014fba13c98cb98de1 Mon Sep 17 00:00:00 2001 From: Lee Li Date: Tue, 5 Nov 2024 12:59:14 +0800 Subject: [PATCH] Update index.js Add remarks for wildcard parameters of Express 5.x --- examples/downloads/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/downloads/index.js b/examples/downloads/index.js index c47dddd738..228755402e 100644 --- a/examples/downloads/index.js +++ b/examples/downloads/index.js @@ -21,8 +21,8 @@ app.get('/', function(req, res){ '') }); -// /files/* is accessed via req.params[0] -// but here we name it :file +// /files/*file works only on express 5.x +// for more information checking wildcard parameters of path-to-regexp app.get('/files/*file', function (req, res, next) { res.download(req.params.file.join('/'), { root: FILES_DIR }, function (err) { if (!err) return; // file sent