【发布时间】:2022-01-13 21:07:09
【问题描述】:
所以我有一个 api,我必须在 URL 中传递汽车制造商、型号、年份。我有快速路由器后调用来获取查询参数并设置为对象。
我需要能够接受 URL 中的参数,所以说 localhost:8080/cars/[不确定这个语法但我需要 make:Audi?model:A4?year:2017]
我不确定 & 和 ?在上面的网址中,所以请更正它。
router.post('/:make[not sure of this either but need to accept all params]),
function(req,res)
{
var make: req.query.make // here I should be able to get make of car and it should match query url
}
请说明我需要进行 post call 的实际 URL 和 router.post 的 URL
~SRJ
【问题讨论】:
-
您能否举一个更好的例子来说明您要处理的 URL 类型?
标签: javascript express url router