<分区>
我在前端应用程序上使用 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
。