gpt4 book ai didi

javascript - express 无法从 url 获取查询参数

转载 作者:可可西里 更新时间:2023-11-01 16:46:32 26 4
gpt4 key购买 nike

<分区>

我在前端应用程序上使用 express 框架和 react 来管理 Node 应用程序上的 http 请求。一个有方法:

app.get('/api/matches', async (req, res) =>  {
console.log(req.originalUrl); // /api/matches/
console.log(req.query); // {}
...

当我使用像 http://localhost:3000/matches?id=123 这样的 url 时,我希望在 req.query 中得到 id > 对象,但我得到的是空的 {} 对象。我还尝试检查 express 如何使用 originUrl 对象查看 url,它的返回没有 query ?id=123

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com