I'm trying to use the Express app.param() feature like this:
app.route('/blueprints/:subject?/:date?/:lang?')
.get(blueprints.query);
app.param('subject', blueprints.filterBySubject);
app.param('date', blueprints.filterByDate);
app.param('lang', blueprints.filterByLang);
It works for /blueprints/abc/2014-02-02/en
but doesn't fire when using /blueprints?subject=abc&date=2014-02-02&lang=en
. Am I doing something wrong, is that a bug or just the way it's supposed to work?
remove the question marks ...
app.route('/blueprints/:subject/:date/:lang')
and (just for better style) I favour to put app.param on top.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.