gpt4 book ai didi

javascript - Node.js:如何从请求正文中获取调用 POST 的页面的 URL?

转载 作者:搜寻专家 更新时间:2023-11-01 00:35:27 24 4
gpt4 key购买 nike

我正在 Node.js 上构建一个 ExpressJS 网络应用程序。

我有一个由 GET 路由呈现的页面:“http://localhost:3000/items/showItemList?status=0 ”。

此页面调用 POST:“http://localhost:3000/items/approve”。

在 POST 路由中,我想获取原始页面“http://localhost:3000/items/showItemList?status=0”的 URL。

router.post('/approve', async function(req, res, next) {
// How to get the Url to the originating page.
});

最佳答案

你可以像这样从req参数中得到

req.headers.referer

关于javascript - Node.js:如何从请求正文中获取调用 POST 的页面的 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53663004/

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