在Express中使用URL中的多个参数

在Express中使用URL中的多个参数,第1张

在Express中使用URL中的多个参数
app.get('/fruit/:fruitName/:fruitColor', function(req, res) {    var data = {        "fruit": { "apple": req.params.fruitName, "color": req.params.fruitColor        }    };    send.json(data);});

如果那不起作用,请尝试使用console.log(req.params)看看它能为您提供什么。



欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5620127.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-15
下一篇2022-12-16

发表评论

登录后才能评论

评论列表(0条)

    保存